Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by josh on Oct 09, 2008 19:43
open dhtmlx forum
updateFromXML

hello,

have a question regarding your updateFromXML method for grid/treegrid dhtmlx objects.

1) Is it possible to have newly added rows at the top of the grid instead of at the bottom?

2) what are the conditions that decide whether a row has changed? if userdata changes or background/styling of row changes, the updateFromXML doesnot consider this row to be updated...is this normal behaviour?

3) if values are no longer present in the new retrieved XML, the corresponding rows are NOT deleted from the grid...is this expected behavior?


Just wondering if there was any easy way to get any of the above to work properly? Else, i guess i'll stick with the classic clear/load.


Thanks,
Answer posted by Support on Oct 10, 2008 05:20
>>1) Is it possible to have newly added rows at the top of the grid instead of at the bottom?
Only by code modification
dhtmlxgrid.js , line 4733
      this.rowsBuffer.push({  //need to be changed to add to first position
line 4746
     this._insertRowAt(row,-1) //second parameter need to be changed to 0

>>2) what are the conditions that decide whether a row has changed?
Actually grid updates data for all rows which exist in grid, but it not revert back any additional settings ( such as styles and userdata ) 
The main usage for updateFromXML - updating rows data, it may be not reliable for updating styles.

>>3) if values are no longer present in the new retrieved XML
grid compare new and old XML by row IDs , so if there is no row with some ID in XML, but it exists in grid - such row will be deleted ( only if 3rd parameter of updateFromXML set to true )

>>Just wondering if there was any easy way to get any of the above to work properly? 
(3) must work correctly if correct IDs | parameters provided
(2) works correctly for cell values and new attributes, but not clear old attributes
(1) can't be easily changed
Answer posted by dactar on Feb 19, 2009 11:23
Hello :)

Is the question 1 planed to be solved by a parameter in a future version ?

Thanks for your answer :)
Answer posted by Support on Feb 20, 2009 05:02
Oncoming release will not have any modification related to updateFromXML feature. 
In long run - we have plans to replace updateFromXML to datasource agnostic method ( which will be able to do the same functionality but with all data types xml, csv, json ) , probably ability to configure, how new rows added - will be added as well.