EasyUI
Home
Demo
Tutorial
Documentation
Download
Extension
Contact
Forum
EasyUI Forum
March 28, 2024, 07:24:03 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
>
retrieve all values from one particular column in datagrid
Pages: [
1
]
« previous
next »
Print
Author
Topic: retrieve all values from one particular column in datagrid (Read 4105 times)
wymak
Newbie
Posts: 26
retrieve all values from one particular column in datagrid
«
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
Re: retrieve all values from one particular column in datagrid
«
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
« 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...