EasyUI Forum
November 06, 2025, 06:45:43 PM *
Welcome, Guest. Please login or register.

Login with username, password and session length
News:
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: getting datagrid data from php  (Read 7732 times)
my888
Newbie
*
Posts: 3


View Profile Email
« on: April 20, 2015, 06:15:37 PM »

Hi,

I have the following datagrid in my html file:

<table id="dg" title="Service Items"
      toolbar="#toolbar" pagination="true" idField="sequence"
      rownumbers="true" fitColumns="true" singleSelect="true">
      <thead>
         <tr>
            <th field="date" width="10" >Date of Service</th>
            <th field="code" width="5" >Item</th>
            <th field="desc" width="30" >Description</th>
            <th field="amount" width="7" >Amount</th>
         </tr>
      </thead>
</table>
.
.
.
$(function(){
   $('#ff').form({
      url:'form1_proc.php',
.
.

How do I read this datagrid data from form1_proc.php file?
Logged
stworthy
Administrator
Hero Member
*****
Posts: 3581


View Profile Email
« Reply #1 on: April 20, 2015, 08:07:17 PM »

You can call 'getRows' method to get all the rows and then post them to your server.
Code:
var rows = $('#dg').datagrid('getRows');
$.post({
  url: ...,
  data: ..., // stringify the rows
  //...
});
Logged
my888
Newbie
*
Posts: 3


View Profile Email
« Reply #2 on: April 21, 2015, 10:32:55 PM »

thank you and I found a solution and that is how I have done:
in html:
1) create a hidden field
2) stringify the datagrid array
3) assign stringify data to the hidden field

in php:
$temp = html_entity_decode($_REQUEST['myHiddenField']);
$dg = json_decode($temp);

foreach ($dg as &$dg1) {
        $dg1=get_object_vars($dg1);
        $date = $dg1['date'];
.
.
}
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!