EasyUI Forum
May 16, 2024, 06:12:50 PM *
Welcome, Guest. Please login or register.

Login with username, password and session length
News:
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: How to update a treegrid node's id?  (Read 8482 times)
kingor2001
Jr. Member
**
Posts: 61


View Profile
« 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.
Logged
stworthy
Administrator
Hero Member
*****
Posts: 3581


View Profile Email
« Reply #1 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'
}
});
Logged
kingor2001
Jr. Member
**
Posts: 61


View Profile
« Reply #2 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.
Logged
stworthy
Administrator
Hero Member
*****
Posts: 3581


View Profile Email
« Reply #3 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
Logged
kingor2001
Jr. Member
**
Posts: 61


View Profile
« Reply #4 on: June 22, 2014, 09:27:47 PM »

It's fixed. Thank you!
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!