Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by Jennifer on Oct 21, 2008 11:01
open dhtmlx forum
Is there a way to insert an XML string directly into a row?

Just what the title says: is there a way to insert an XML string directly into a row in the pro version?

So instead of parsing the entire grid as
<data><rows><row><cell>..</cell><cell..</cell></row></rows></data>

I can insert just one row:
<row><cell>..</cell><cell>..</cell></row>

Thanks in advance!

Answer posted by Support on Oct 22, 2008 01:55
Grid doesn't support such operation as adding new rows from XML string, but you can use grid.updateFromXML command , which adds any new row from XML. 
By default command oriented of loading data from remove url, not from string, but it can be workarounded as

grid._refresh_mode=[true,true];
grid.parse("xml string here"); //xml string as "<rows><row id="XX"><cell>..</cell><cell>..</cell></row></rows>"


Answer posted by Jennifer on Oct 22, 2008 07:33

So I have:

mygrid._refresh_mode=[true,true];

mygrid.parse("<rows><row id='24'><cell>fdsaf</cell><cell>fdsaf</cell><cell>fdsaf</cell><cell>fdsaf</cell><cell>fdsaf</cell><cell>fdsaf</cell><cell>fdsaf</cell><cell>fdsaf</cell><cell>fdsaf</cell><cell>fdsaf</cell><cell>fdsaf</cell><cell>fdsaf</cell><cell>fdsaf</cell><cell>wwww</cell></row></rows>");

If row with id 24 does not exist, then it should create a new one, right?

This doesn't seem to be working, I keep getting that "doXPath(..).0 is null or not an object".

 

 

Answer posted by Support on Oct 22, 2008 08:45
Issue confirmed. 
As it was mentioned - updateFromXML was designed to be used with remote url, and not works with local data as expected. 
Drop attached patch after common grid's files - it will resolve problem. ( the same fix will be added to main codebase ) 
Attachments (1)
patch.zip751.00 B
Answer posted by susie on Oct 23, 2008 05:56

where/how do i insert this patch??

thanks

Answer posted by Support on Oct 23, 2008 06:24
Just add this code after all other js files ( or to the end of dhtmlxgrid.js ) 
Answer posted by Dirk on Oct 30, 2008 09:34
This patch provides the desired behavior (e.g. "appending" new rows). It appears to cause a regression issue when interactively selecting multiple rows, and invoking .deleteSelectedRows() failing after the first selection set deletion with the error:

this._fillers is undefined

Regards,
Dirk
Answer posted by Support on Oct 30, 2008 10:36
Such issue can be reconstructed if you are using it with dhtmlxgrid 2.0 and combination of srnd and split modes.
Please contact us directly at support@dhtmlx.com , we will provide updated version which contains above patch and has not problem with split+srnd modes.