EasyUI Forum
March 28, 2024, 07:24:03 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: retrieve all values from one particular column in datagrid  (Read 4105 times)
wymak
Newbie
*
Posts: 26


View Profile
« on: July 05, 2018, 01:51:19 AM »

I have a datagrid with 2 columns (id and temperature) , something like below:   

<table id="dg" title="View Log" class="easyui-datagrid" style="width:auto;height:auto;"
            url="getlog.php" >
        <thead>
            <tr>
                <th field="id">ID</th>
                <th field="temperature">Temperature</th>
            </tr>
        </thead>
</table>

How can I retrieve the array of temperature values from the datagrid,
arr  = $('#dg').datagrid('options').columns['temperature']   does not work.

thanks,
Mak
Logged
stworthy
Administrator
Hero Member
*****
Posts: 3581


View Profile Email
« Reply #1 on: July 05, 2018, 03:39:10 AM »

Call the 'getRows' method to get all the rows and convert to the array you want.
Code:
var rows = $('#dg').datagrid('getRows');
var arr = $.map(rows, function(row){return row. temperature});
console.log(arr);
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!