EasyUI Forum

General Category => General Discussion => Topic started by: btork on November 05, 2016, 06:51:06 AM



Title: Reload TreeGrid not updating grid
Post by: btork on November 05, 2016, 06:51:06 AM
I'm trying to reload all the data in the TreeGrid with a button. I can see from the network console that it's retrieving the json data and the grid flashes, but the data isn't updating.

Here's my javascript function:
           function reloadAll(){
                       $('#tt').treegrid('reload');
           }

<a href="javascript:void(0)" class="easyui-linkbutton" onclick="reloadAll()">Reload</a>


<table id="tt" class="easyui-treegrid" style="width:100%;height:550px;"
         url="leaderboarddata.php?tourney=<?php echo $_GET['tourney'] ?>"
         rownumbers="false"
         idField="scorecardid" treeField="name"
         data-options="onClickCell:function(field,row){
          if (field == 'name'){
              $(this).treegrid('toggle', row.scorecardid);
          }
         }">

Thanks,
Brian


Title: Re: Reload TreeGrid not updating grid
Post by: jarry on November 05, 2016, 11:45:16 PM
Please look at the network console, Is the returning data from server correct after calling the reload method.


Title: Re: Reload TreeGrid not updating grid
Post by: btork on November 06, 2016, 06:51:47 AM
Yes, the data is correct in the network console, but the grid doesn't update.


Title: Re: Reload TreeGrid not updating grid
Post by: btork on November 06, 2016, 07:06:39 AM
Do I need to rebind the data to the table after I call Reload? I'm stumped here why this isn't updating.


Title: Re: Reload TreeGrid not updating grid
Post by: btork on November 06, 2016, 10:05:21 AM
Can anyone post an example of a treegrid that works with the Reload method?


Title: Re: Reload TreeGrid not updating grid
Post by: btork on November 07, 2016, 11:10:26 AM
I figured out that my issue was a data problem. My children records did not have the id field populated. This caused an issue when the reload method attempted to repopulate the data in the grid.

Hope that can help someone in the future.