EasyUI Forum

General Category => EasyUI for jQuery => Topic started by: CLKG on August 10, 2015, 10:40:58 PM



Title: problem when reload treegrid
Post by: CLKG on August 10, 2015, 10:40:58 PM
I use $('#tg').treegrid('reload', id) for partial refresh of a treegrid, it only works when a node already has children or had children but got deleted, which means if the node's icon is a document not a folder, after I add some children nodes to this node, the partial refresh will not work, nothing will happen to the treegrid when I invoke the reload function, I'm sure the id param is right.


Title: Re: problem when reload treegrid
Post by: stworthy on August 10, 2015, 11:57:48 PM
The 'reload' method works only on the non-leaf nodes. If you want to append some child nodes on a leaf by calling 'reload' method, please call 'update' method to make it become non-leaf node first.
Code:
var tg = $('#tg');
tg.treegrid('update', {
  id: id,
  row: {state:'closed'}
});
tg.treegrid('reload', id);


Title: Re: problem when reload treegrid
Post by: CLKG on August 11, 2015, 12:36:22 AM
Got it, thanks!