One of the new features in Grid 3.4 is the ability to select non-contiguous rows by CTRL-clicking on the desired rows. This allows for more robust manipulation of records in the Grid.
As stated above, you can CTRL-click to select the desired rows. You can access the selected rows as XML records using the array returned by the nitobi.grid.getSelectedRows() method.
To enable this feature, make sure the following are turned on. (Note: all other grid attributes are removed in this example for clarity)
Once this is done, the grid will now allow for multiple rows to be selected. Then, the rows can be manipulated, either directly by editing the XML that is being returned, or by using certain attributes to call other methods to change the grid. Here is an example function that was taken from the CompleteUI demo that shows how to manipulate the selection.
The first thing that we do is get the grid. Then we get the selected rows with this call:
Then after that, we loop through the rows and manipulate the data that is in the column index col at the grid index.xi which was retrieved from the selected row. We got the index by using the xi attribute of the row objects that are contained in the selection.
And then we use the index to get the Cell Object, and we set the value:
Comments:
Knowledgebase
To be notified of new articles when they're available, subscribe to our RSS feed.