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");
I have selected 2 rows from page1 and page2. I get correct index value for page2 but I am getting -1 for page1.
When i have single page then below code works fine
Please help to get value or index of selected rows from iggrid with different pages.
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.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.
I have tried your samples as mentioned above.
The syntax firstSelectedRowID = selectedRows.id returns 10 digit value
how to consume it to get row value