Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by Allan Hansen on Feb 06, 2009 02:20
open dhtmlx forum
grid and adding row in position -1

When I try to use the following:

mygrid.addRow("123x",[""],-1);

The new row ends up in position 1, and not in the bottom of the grid. Can you help me?
Answer posted by Support on Feb 06, 2009 04:52
In which moment you are using such code? 
Beware that XML loading is async., so if you are using this code when XML data not really loaded yet, it will be added to the first position ( because other rows not loaded from XML yet )  - you can use onXLE event or second parameter of load method to catch the moment when all data already loaded.

Answer posted by Allan Hansen on Feb 06, 2009 05:29
It a long way further down the code than mygrid.init() and mygrid.loadXML(). I've found that if I use -2 instead, then it adds the row at the bottom of the grid.
Answer posted by Support on Feb 06, 2009 06:30
>>It a long way further down the code 
If it executed in same js thread - it doesn't matter, time of js script execution is much smaller than time of xml loading. 
Please try to use

grid.load(url,function(){
           mygrid.addRow("123x",[""],-1);
});
Answer posted by Allan Hansen on Feb 06, 2009 06:42

Beautiful, that was it, thanks a lot.

While I have you guys here, I've sent an email about retrieving the datalink folder, it wasn't in our zip-file. Would you look at it?

Answer posted by Support on Feb 06, 2009 07:18
Mentioned extension doesn't supported anymore. The old version of it still can be used with latest grid and tree, but we recommend to use dataprocessor with custom routine.
http://dhtmlx.com/docs/products/dhtmlxGrid/doc/articles/Dataprocesor_usage.html#grid_art_dataprocessor

( old version of lib will be sent to you by email in nearest time )