Nitobi
Customer Login
Services
Products
About
Blogs
Contact
Home -> Product Knowledgebase Order Online | Free Trial Downloads

Nitobi Product Knowledgebase

How to use Multi-Select


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)

<ntb:grid id="MultiSelectGrid"
   rowhighlightenabled="true"
   rowselectenabled="true"
   multirowselectenabled="true">

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.

function setDefault( col )
{
 var msGrid = nitobi.getGrid('MultiSelectGrid');
 var selectedRows = msGrid.getSelectedRows();
 
 for( var i = 0; i < selectedRows.length; i++ ) {
  var xi = selectedRows[i].getAttribute("xi");
  var celly = msGrid.getCellObject( xi, col);
  celly.setValue( "Paralegal" );
  
  
 }
}

The first thing that we do is get the grid.  Then we get the selected rows with this call:

 var selectedRows = msGrid.getSelectedRows();

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.

var xi = selectedRows[i].getAttribute("xi");

And then we use the index to get the Cell Object, and we set the value:

  var celly = msGrid.getCellObject( xi, col);
  celly.setValue( "Paralegal" );

View Printable Version

Comments:


Name:

Type the text you see above:

Comments:


Knowledgebase

To be notified of new articles when they're available, subscribe to our RSS feed.

Support Resources

Take advantage of our knowledgebase of product tutorials and tips, and our support forums!

Search Site


Sign up for our Newsletter:

Get industry articles and Nitobi company news in your inbox every couple of months — here's a sample!

Email:




Site RSS Feed  | All contents are (c) Copyright 2006, Nitobi Software Inc. All rights Reserved