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
25
Virtualization and "Select All" checkbox
posted

With virtualization enabled and a user checking the checkbox to "select all", only a handful of records gets reported as selected when requesting the selected rows from the grid. 

How do I retrieve all the selected rows, regardless of whether virtualizatoin is enabled or not?  Basically i need a code way to get all the rows selected, regardless of whether the user scrolled down 10,000 rows and selected one there after selecting the first row in the list. 

Am I missing something obvious?

  • 23953
    Offline posted

    Hello Sean,

    There is a Known Issue which states: "igGridSelection works only with visible rows when virtualization is enabled". Because selectedRows API is using the Selection, this means that the API will report only the currently available selected TR DOM elements.

    When Virtualization is enabled you cannot get all the selected rows as DOM elements.

    If you want to get all the selected rows as objects then you can check the state of the "select all" checkbox and get the records directly from the grid data source.
    To check the state of the "select all" checkbox use the following code:
    var checked = $("#grid1").data("igGrid").headersTable().find("span[name='hchk']").attr("data-chk") === "on";

    where "grid1" is the id of the grid.

    To get the records from the data source use the following code:
    $("#grid1").data("igGrid").dataSource.data();

    P.S.: There is also and issue that when the user checks the "select all" checkbox and scrolls the virtual grid the new rows will not be checked/selected. The issue is with internal development id 138870 and will be resolved in one of our future service releases.


    Best regards,
    Martin Pavlov
    Infragistics, Inc. 

  • 25
    posted

    I should mention this is using 2012.2