EasyUI
Home
Demo
Tutorial
Documentation
Download
Extension
Contact
Forum
EasyUI Forum
May 16, 2024, 08:06:21 AM
Welcome,
Guest
. Please
login
or
register
.
1 Hour
1 Day
1 Week
1 Month
Forever
Login with username, password and session length
News
:
Home
Help
Search
Login
Register
EasyUI Forum
>
General Category
>
EasyUI for jQuery
>
Getting row data for a particular index
Pages: [
1
]
« previous
next »
Print
Author
Topic: Getting row data for a particular index (Read 11525 times)
tomhj
Newbie
Posts: 40
Getting row data for a particular index
«
on:
July 16, 2012, 01:38:26 PM »
Perhaps I'm overlooking it, but I don't see a way to get the data for a row in a datagrid based on it's index. getSelected() and getSelections() returns the row data for the selected row (or rows) and I see the getData() function - but I dont see a getData(index) method.
Is there a way to get that?
Logged
stworthy
Administrator
Hero Member
Posts: 3581
Re: Getting row data for a particular index
«
Reply #1 on:
July 16, 2012, 03:23:01 PM »
To get a particular index row, please call getRows method.
var rows = $('#dg').datagrid('getRows');
var row = rows[index];
Logged
tomhj
Newbie
Posts: 40
Re: Getting row data for a particular index
«
Reply #2 on:
July 16, 2012, 05:18:13 PM »
Does that work even if the data is paginated? Not sure if the first row on each page restarts at index=0.
Logged
stworthy
Administrator
Hero Member
Posts: 3581
Re: Getting row data for a particular index
«
Reply #3 on:
July 16, 2012, 08:47:36 PM »
The 'getRows' method return the current page rows. The first row index of each page is 0, the second row index is 1, etc.
Logged
tomhj
Newbie
Posts: 40
Re: Getting row data for a particular index
«
Reply #4 on:
July 17, 2012, 09:18:26 AM »
Great - added the following to my code; works well.
Perhaps this would make a nice addition to the library?
$.extend($.fn.datagrid.methods, {
getDataForIndex: function(target, index){
var rows = $(target).datagrid('getRows');
return rows[index];
}
});
Thanks
Logged
Radikal
Newbie
Posts: 1
Re: Getting row data for a particular index
«
Reply #5 on:
August 26, 2013, 09:36:07 AM »
Code:
var row = $('#dg').datagrid("getRows")[index];
Logged
Pages: [
1
]
Print
« previous
next »
Jump to:
Please select a destination:
-----------------------------
General Category
-----------------------------
=> News
=> General Discussion
=> EasyUI for jQuery
=> EasyUI for Angular
=> EasyUI for Vue
=> EasyUI for React
=> Bug Report
Loading...