I'm trying to use the "rowById" function on a grid (with paging) with a primary key. If the Id that I am looking for is on the "current" page it finds it fine. But if it is on not on the current page it is not found. Is there a way to use "rowById" if I don't know which page the Id will be found on? I want to find the row and get the index from it so I can programmatically move to the correct page and then select that row by index and save the index off. The code I am using is simple - but doesn't work if the Id is on a different page than the current one.
var row = $(gridId).igGrid("rowById", 123);if (row) indexToSelect = row.index();
Hello Ryan,
If I can provide you with further assistance regarding this matter, please let me know.
Regards,Tsanna
Yes I can access that and I had tried it previously. It only returns the data for the current page however. I believe the way we are filling the grid, we are not actually passing back the data for all pages from the server, just the current page + number of records. Because of this I don't think there is a way to do what I want to do. So I have moved on at this point - I don't think what I am trying is possible with the way we are doing the remote paging.
You may get the igDataSource instance and call some of its API methods to access your data, for instance $("grid").data("igGrid").dataSource._data. Please let me know if this works for you.
$("#grid").data("igGrid").options.dataSource gives me a URL that is used to return the data source from the server. Is there something else that can give me the datasource, because what you sent is not giving me an array of the records.
Hi Ryan,
By finding the record in the dataSource I meant you access the grid dataSource using for example the following code: $("#grid").data("igGrid").options.dataSource. This will return you an array of all records in your dataSource and you can find the desired record and its index. Does this help you achieving your purpose?