Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by C. Bernstein on Oct 13, 2009 09:31
open dhtmlx forum
Non editable tree grid get changed/added rows

How can I find the added rows to a tree grid (since the grid was loaded)? I am trying to use getChangedRows(true) but it isn't working - is this only supposed to work for editable grids? If so, how can I find the added rows to a tree grid that is not editable (the rows were added using drag and drop from another grid)?
Thanks.
Answer posted by Stanislav (support) on Oct 14, 2009 02:44
If you are using grid 2.5 try to use

var ids = grid.getChangedRows(true);

Normally the command returns list of rows which was edited by user, "true" as parameter will force reporting about added rows as well. 
Answer posted on Oct 14, 2009 05:42
I am using version 2.1.  How would I do it using this version?  I have already tried getChangedRows(true) (see first post) but it isn't working.
Answer posted by Stanislav (support) on Oct 14, 2009 09:03
If your version is old and doesn't support such functionality you can try to add id manually as

var added = [];
grid.attachEvent("onDrop",function(sid,tid,nid,sgrid,tgrid){
    if (sgrid!=tgrid) added.push(nid);
})

as result , "added" will contains array of all IDs which was dragged in the target grid.