EasyUI Forum

General Category => EasyUI for jQuery => Topic started by: Wojak on February 01, 2023, 05:47:09 AM



Title: Datagrid get row by index in pagination
Post by: Wojak on February 01, 2023, 05:47:09 AM
Hey,
The problem I have is that when I fetch all the rows from the datagrid with pagination and want to find it by index it doesn't find it. If pagination is set to 100 rows then being on 400 row it shows no row found

Code:
const id_found = $('#example-dg').datagrid('getRowIndex', id);
const row = $('#example-dg').datagrid('getRows')[id_found];

if (row) {
    // Some code
} else {
    $.messager.alert("Alert", "Not found !!!", "warning");
}


Title: Re: Datagrid get row by index in pagination
Post by: jarry on February 02, 2023, 02:00:04 AM
The 'getRowIndex' method only returns the loaded row index in a page. If the loading data exceeds the page size, it will be cut off before loading into the datagrid.


Title: Re: Datagrid get row by index in pagination
Post by: Wojak on February 02, 2023, 10:23:48 AM
So if pagination is set to 100, getRows will return only 100 rows and not 400? I'm just curious why when I'm on the 200th line it works and on the 3xx it doesn't