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
85
iggrid get selected row values or index from different pages
posted

Hi,

I am trying to get the selected row index from iggrid with different pages in jquery.

When I have only single page then I am able to get value. But when i have multiple pages in grid then i am not able to get the records/values/index.

var grid = $(iggridid).igGrid("selectedRows");

Scenario1:

I have selected 2 rows from page1 and page2. I get correct index value for page2 but I am getting -1 for page1.

Scenario2:

When i have single page then below code works fine

grid[0].element.context.rows[j].cells[1].inntertext;

Please help to get value or index of selected rows from iggrid with different pages.

Thanks

Mukesh

Parents
  • 17590
    Offline posted

    Hello Mukesh,

    Thank you for posting in our community.

    The behavior that you are experiencing is expected. By design, when Paging is enabled the index correspond to the current visible index of the row. Since rows from pages, that are currently not in the view area do not have actual visible index their index is set to -1. If you would like to uniquely identify the rows and get reference to their cell values you can use the getCellValue ot getCellText methods. For example:

       var selectedRows =  $("#grid").igGrid("selectedRows"),

             firstSelectedRowID = selectedRows[0].id,

            cellValue =  $("#grid").igGrid("getCellValue", 3, "col_key");

    Additionally, please keep in mind if you select rows across different pages and Row Selectors feature is not enable you have to hit Ctrl key while you are making the selection to ensure that previously selected rows are not dissected.

    Please test my suggestion on your side and let me know if you need any further assistance with this matter.

Reply Children