EasyUI Forum
March 28, 2024, 01:44:17 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: [SOLVED] treegrid get current id changes  (Read 6855 times)
catpaw
Jr. Member
**
Posts: 85


View Profile Email
« on: January 31, 2017, 07:21:17 PM »

hello, Im using treegrid edit mode like http://www.jeasyui.com/demo/main/?plugin=TreeGrid&theme=default&dir=ltr&pitem=

(Editable TreeGrid)

but in the save function of the demo,
only showed how end editing row, and I have not been able to find the method to get the data just changed

I readed the forum and saw a post where used find method, but this get all rows, not the current row I just changed

this my code so far

Code:
function save(){
if (editingId != undefined){
var t = $('#tg-areas');
t.treegrid('endEdit', editingId);

//send data & save to db
var row = t.treegrid('find',editingId);
alert(JSON.stringify(row)); --> this print all rows data

editingId = undefined;
}
}

some help please, thaks
« Last Edit: February 05, 2017, 06:43:55 PM by catpaw » Logged
stworthy
Administrator
Hero Member
*****
Posts: 3581


View Profile Email
« Reply #1 on: February 01, 2017, 06:51:15 AM »

Please listen to the 'onAfterEdit' event, retrieve the current saved row and post to server.
Code:
$('#tg').treegrid({
onAfterEdit: function(row){
//post to server
}
});
Logged
catpaw
Jr. Member
**
Posts: 85


View Profile Email
« Reply #2 on: February 01, 2017, 09:12:24 AM »

hi stworthy

I did what you said, but Im still get all rows not just what I have changed

Code:
$('#tg-areas').treegrid({
onAfterEdit: function(row){
alert(JSON.stringify(row));
}
});

I dont understand why this hapens


other question how I determinated with onAfterEdit event if have changes or was canceled???
« Last Edit: February 01, 2017, 10:48:46 AM by catpaw » Logged
catpaw
Jr. Member
**
Posts: 85


View Profile Email
« Reply #3 on: February 01, 2017, 11:01:11 AM »

I just realized that

Quote
I did what you said, but Im still get all rows not just what I have changed

Code:
$('#tg-areas').treegrid({
   onAfterEdit: function(row){
      alert(JSON.stringify(row));
   }
});

not returned all rows, return the row changed and his childrens

so the question is, how I get the only the row data I changed?

thanks

---------------- Edit

hi again, I understand now, not returned all rows, it return the childrens as subarray

thanks I think the issue is resolved
« Last Edit: February 01, 2017, 11:18:20 AM by catpaw » 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!