EasyUI Forum
March 29, 2024, 06:09:07 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 JSON data for currently loaded tree grid  (Read 4487 times)
saurabh
Newbie
*
Posts: 12


View Profile Email
« on: January 17, 2017, 03:10:35 AM »

Hello, I want to get currently loaded json data from tree grid(Don't want to call again same servlet to get data.). I tried to do like this as shown below but it doesn't work for me.
json data that i am loading is dynamic....!!

script
var allData=$('#tg').treegrid('getData');
alert("All data length: "+allData.length);
var jsonData=JSON.parse(allData);
alert("jsonData "+jsonData);



tree grid html
 <table id="tg" title="NCM-SCAR Creation Application" style="height:600px;width:100%;"
                data-options="
                    iconCls: 'icon-ok',
                    rownumbers: true,
                    animate: true,
                    collapsible: false,
                    fitColumns: true,
                    url: 'getNCMdataServlet',
                    method: 'get',
                    idField: 'id',
                    treeField: 'name',
                    pagination: true,
                    onExpand:function(row)
                    {
                       collpaseTillItemLevel(row,<%=expandRows %>);
                   
                    },
                   
                    checkbox:function (row)
                    {
                       if(row.chbx==1)
                       {
                       return true;
                       }
                       
                    },
                    onCheckNode:function(row,checked){
                   
                    verifyCheck(row,checked);
                       
                 
                   
                     },
                     onLoadSuccess:function()
                   {
                   collapseAllChilds()
                   },
                    pageSize: 10,
                    pageList: [10,20,50]
                ">
            <thead>





Logged
stworthy
Administrator
Hero Member
*****
Posts: 3581


View Profile Email
« Reply #1 on: January 17, 2017, 08:17:51 AM »

The 'getData' method does returns the loaded data.
Code:
var allData=$('#tg').treegrid('getData');
console.log(allData);
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!