Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by Wojski on Sep 07, 2008 09:59
open dhtmlx forum
Multiselection by API..

Hi.. I use the getSelectedRowId() to store curently selected rows, then change this list a liitle and want to make a new selection based on modified list wich of course contain rows ids separated by the coma sign.

I'm spliting returned string into string array contains single row id and in the loop tried to perform this action on every row:

grid.selectRow(grid.getRowIndex(selectingArray[index], false ,true, false))

where selectingArray[index] is string with row id.

I belived that the third argument prevent me from clear previous selection, but now it selects all rows in the order, but deselecting row from previous iteration when selecting next one.

!!! The problem is that i want to select all rows from the list, and hold it selected !!!


Additional info:

- i get the selected rows list while onKeyPress event is called.
- i make selection in onBeforeSelect event method.
- i lock onBeforeSelect event while selecting rows from inside of this method (to avoid infinite loop)
- i clear all selection before new selection loop starts.
- i am using PRO version, v15

Any ideas how to deal with this problem?
Answer posted by Support on Sep 08, 2008 05:44

>>grid.selectRow(grid.getRowIndex(selectingArray[index], false ,true, false))
The command is correct and must work as expected. ( selecting row, while preserving previous selection )

>>I belived that the third argument prevent me from clear previous selection
This is correct.

>>- i make selection in onBeforeSelect event method.
Be sure to return "false" after finishing all operation in onBeforeSelect event, because in other case, default selection logic will fire and may change results of your selectRow commands

Working sample for grid 1.5 sent by email.  
If issue still occurs for you - please provide any kind of sample where it can be reconstructed ( you can send it directly to support@dhtmlx.com )