EasyUI Forum
March 28, 2024, 03:56:00 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: DataGrid create table get json object  (Read 23370 times)
mars610
Newbie
*
Posts: 13


View Profile Email
« on: July 21, 2011, 06:08:47 PM »

I used DataGrid to create table , the program return json string like this:
[{
   "children":[
   {
   "children":[],
   "createDate":null,
   "creator":null,
   "description":"",
   "groupName":"eeeeeeee",
   "groupNo":"eeeeee",
   "isLeaf":0,
   "localeKey":null,
   "members":[],
   "parent":null,
   "sysId":3,
   "updateDate":null,
   "updateOperator":null
   }],
   "createDate":null,
   "creator":null,
   "description":"",
   "groupName":"123",
   "groupNo":"123",
   "isLeaf":1,
   "localeKey":null,
   "members":[],
   "parent":null,
   "sysId":1,
   "updateDate":null,
   "updateOperator":null
   },
   {
   "children":[],
   "createDate":null,
   "creator":null,
   "description":"",
   "groupName":"eeeeeeee",
   "groupNo":"eeeeee",
   "isLeaf":0,
   "localeKey":null,
   "members":[],
   "parent":{
    "children":[null],
    "createDate":null,
    "creator":null,
    "description":"",
    "groupName":"123",
    "groupNo":"123",
    "isLeaf":1,
    "localeKey":null,
    "members":[],
    "parent":null,
    "sysId":1,
    "updateDate":null,
    "updateOperator":null
    },
    "sysId":3,
    "updateDate":null,
    "updateOperator":null
}]

This string is tree data, I wanna use to create table,so html code like this:

<table id="listorg" class="easyui-datagrid"
title="<s:text name='list.org.title'/>"
url="permission/org!getOrganizationList" nowrap="false" striped="true" toolbar="#tb" idField="sysId" singleSelect="true" pagination="true">
<thead>
<tr>
<th field="groupNo" width="120"><s:text name="list.org.no" /></th>
<th field="groupName" width="120"><s:text name="list.org.name" /></th>
<th field="description" width="120"><s:text name="list.org.desc" /></th>
<th field="parent" width="120"><s:text name="list.org.parentName" /></th>
</tr>
</thead>
</table>

look the red font , if you can't ,look the html colum 'parent',result the page show '[object Object]'.

Ok, How should I get the data in the 'parent'?
Logged
stworthy
Administrator
Hero Member
*****
Posts: 3581


View Profile Email
« Reply #1 on: July 21, 2011, 08:10:52 PM »

Use 'formatter' function to format your 'parent' field value. Below is the tutorial:

http://www.jeasyui.com/tutorial/datagrid/datagrid7.php
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!