Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
1145
igGrid Selection Persistence: after a refresh removes the only selected row, igGridSelection still returns an object for that previous selected row
posted

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:

{elementjQuery.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


Parents Reply
  • 17590
    Offline posted in reply to Aidan Reel

    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.

Children
No Data