Hi,
Version: 14.2.20142.2477.
I have a grid with a number of rows (say 10) the first row is selected.
An event occurs that causes a new data binding to be processed that will remove the first row data.
When the data binding has completed, the original row 0 is gone and we are displaying nine rows, none of which are selected.
That is what we expect.
However, if I query the grid for its selected rows using igGridSelection('selectedRows')
I receive back an array containing 1 object:
{element: jQuery.fn.init[0], id: "XXXYYY",index: -1}
where XXXYYY is a guid, which is the id of the original row0.
Is this the expected behaviour?
If so how do you recommend removing this from the selectedRows.
I have tried directly removing this entry within various event handlers e.g rowSelectionChanged
but the deletion is not persisted as subsequent gGridSelection('selectedRows') queries still returns an array with the above object as the only element.
Regards
Aidan
Hello Aidan,
In case that persist option is set to true my suggestion is to either call clearSelection method which will empty selectedRpws collection or ignore the elements in the selectedRows collection that have index -1 (in case that Virtualization feature is not enabled). Having this elements in the selectedRows collection is the expected behavior of the feature. The reason is that when binding to new data source and persisting selection igGrid keeps track of the previously selected rows and it looks for this rows in the new data source. Since these rows are not available any more the index is set to -1.
By design If the persist option of the Selection feature is set to false this is not going to affect any features different than Selection.
Please let me know if I can provide you any further assistance with this matter.
That will remove any sorting / filtering / selection that has been made, that is too aggressive for our purposes.
We want the selection persisted but NOT when the row is no longer in the grid
Thank you for posting in our community.
What I believe will help you achieve your requirement is persist option of igSelection feature. This option disables/enables persistence between states. By default it is set to true so my suggestion is to set it to false. For example:
//Initialize $(".selector").igGrid({ features : [ { name : "Selection", persist : false } ] });
//Initialize
$(
".selector"
).igGrid({
features : [
{
name :
"Selection"
,
persist :
false
}
]
});
Please test this on your side and let me know whether it helps you achieve your requirement.
Please feel free to contact me if you have any additional concerns or questions.
Thank you for using Infragistics components.