3.2.0

Set selected grid rows to wait for confirmation.

Hi Alex,

I want to be able to highlight the selected rows using a different colour while I wait for confirmation from the server that the rows have been selected on the server. This needs to support single click, control click and shift click. The server request needs to support the rows selected and unselected by the operation.

Should the response from the server timeout, the "pending" rows need to revert to their previous state (selected or unselected).

If confirmation is received from the server the "pending" rows need to be properly selected / unselected.

If the server confirmation returns the dbIDs (non-index) values, what is the most efficient way to complete the selection or unselection?

Currently the GRID data is being loaded via XML.

Many thanks
Matt
August 22,
You can intercept the row selection using onSelectedRowsChanging event -

grid.onSelectedRowsChanging = function(rowIndicesArray){
var oldSelection = this.getSelectedRows();
}

This event fires before the change, so you can still retrieve the old values (the new values are passed as an event argument). At this point you can set some CSS class on the grid or its parent, so the selected rows color will be different, and send the request to the server.
Alex (ActiveWidgets)
August 23,
Thanks Alex,

I'm intercepting the row changing and to reduce the amount of data sent to the server, I am only sending the selection changes.
This includes selecting and unselecting specific rows.

When the server reponds I am using the following code to select specific rows, but how do I specifically unselect a row or rows?

function selectRow(indexes)
{
var objGrid = AW.object("myGrid");

// Disable the onSelectedRowsChanging event temporarily.
objGrid.onSelectedRowsChanging = null;

objGrid.setRowSelected(true, indexes);

// Position so that the selected rows are visible.
objGrid.setCurrentRow(indexes[0]);
objGrid.setCurrentRow(indexes[indexes.length-1]);

// Re-enable the onSelectedRowsChanging event
objGrid.onSelectedRowsChanging = function(a,b,c,d){ return changing(a,b,c,d); };
}

thanks again
Matt
August 28,

This topic is archived.

See also:


Back to support forum