EasyUI Forum
May 16, 2024, 09:55:58 AM *
Welcome, Guest. Please login or register.

Login with username, password and session length
News:
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: Get all rows in datadrid  (Read 15798 times)
lorwynz_11
Newbie
*
Posts: 19


View Profile
« on: November 12, 2013, 07:58:58 PM »

I have created a grid panel.It has no. of records. I want to get all data in the grid when click a button.This function is working, if select entire row using datagrid('getSelections');

is possible get entire data in the grid without select the rows? and is it possible get the value of first column only for each row?
Logged
stworthy
Administrator
Hero Member
*****
Posts: 3581


View Profile Email
« Reply #1 on: November 12, 2013, 08:17:14 PM »

Please call 'getRows' method to get the current page rows.
Code:
var rows = $('#dg').datagrid('getRows');
for(var i=0; i<rows.length; i++){
  console.log(rows[i]['itemid']);
}
Logged
lorwynz_11
Newbie
*
Posts: 19


View Profile
« Reply #2 on: November 12, 2013, 08:49:45 PM »

is console.log is another way of alert function or it's different? where i could find the result of console.log?
Logged
yupengfei
Newbie
*
Posts: 10


View Profile
« Reply #3 on: November 14, 2013, 09:00:08 PM »

call 'getRows' method to get the current page rows.

if your first column field named  'name' ,  the code for get the value of first column only for each row

var rows  = $("#dg").datagrid('getRows');
$.each(rows, function(i, e){
   console.info(e.name);
});
Logged
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines Valid XHTML 1.0! Valid CSS!