EasyUI Forum

General Category => EasyUI for jQuery => Topic started by: kingor2001 on June 22, 2014, 07:03:43 AM



Title: How to update a treegrid node's id?
Post by: kingor2001 on June 22, 2014, 07:03:43 AM
How to update a treegrid node's id?
For example, my treegrid node's id is a primary key, first I append a new node with id 0, then save the node's value to database and get a primary key, at last update the id value 0 to the primary key.


Title: Re: How to update a treegrid node's id?
Post by: stworthy on June 22, 2014, 07:47:30 AM
Call 'update' method to update a specified node.
Code:
$('#tt').treegrid('update',{
id: 2,
row: {
id: ...,  // the new id
name: 'new name',
iconCls: 'icon-save'
}
});


Title: Re: How to update a treegrid node's id?
Post by: kingor2001 on June 22, 2014, 08:17:56 AM
yes, I used the "update" method and the new node row can't be select. I find the node's tr-element don't change, such as
Code:
$treegrid.treegrid('update', {
id : -1,
row : {
"id" : 99,
"userId" : 99 // idField:'userId'
}
});
After "update", the node's tr-element don't be updated : id="datagrid-row-r2-2--1", node-id="-1". The tr also cannot be selected.


Title: Re: How to update a treegrid node's id?
Post by: stworthy on June 22, 2014, 06:36:25 PM
You may need to download the patch from http://www.jeasyui.com/download/downloads/jquery-easyui-1.3.6-patch.zip


Title: Re: How to update a treegrid node's id?
Post by: kingor2001 on June 22, 2014, 09:27:47 PM
It's fixed. Thank you!