Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by David on Jul 24, 2008 14:05
open dhtmlx forum
xmlB using mygrid.parse

I had previously posted a topic "Using xmlB, define column order" and I got a response w/ the fix in 1 day ! ! ! Thx a million.

I found another potential bug.

I modified the sample "init_grid_xml.html" to use mygrid.parse() with an xmlB format. I could not get that to work. There were no errors but it displayed the 3 rows w/ no data ? ? ?

Here are my modifications to "init_grid_xml.html"...

<a href="javascript:void(0)" onclick="mygrid.clearAll();mygrid.xml.top='zzz';mygrid.xml.row='z';mygrid.setColumnIds('a,b');mygrid.parse(document.getElementById('str_xml_custom').value);">Reload from XML string custom</a><br/>

<textarea id="str_xml_custom" style="display:none;"><zzz>
<z id="1">
<a>0</a>
<b>loaded from xml string</b>
</z>
<z id="2">
<a>1</a>
<b>loaded from xml string</b>
</z>
<z id="3" selected="1">
<a>2</a>
<b>loaded from xml string</b>
</z>
</zzz></textarea>

fyi... this did not work w/ the original version of dhtmlxgrid_data.js (before the fix)

Thx in advance
Answer posted by Support on Jul 25, 2008 02:12
You have missed loading type, the correct command will be
    mygrid.parse(document.getElementById('str_xml_custom').value,"xmlB");

It must work with latest version of dhtlmxgrid_data.js
Answer posted by David on Jul 25, 2008 10:04

I added the "xmlB" parameter to the mygrid.parse() and I now get an error.

"Object doesn't support this property or method"

I believe the error occurs here....

dhtmlXGridObject.prototype._process_xmlB=function(xml){
     this._parsing=true;
     var top=xml.getXMLTopNode(this.xml.top);
     ...

}

Answer posted by Support on Jul 28, 2008 02:01
Please check attached sample
Attachments (1)
Answer posted by David on Jul 28, 2008 16:32
Hi, thx for the sample.html, however, the sample does not address the fix in the posting...

index.shtml?cat=search&page=1&q=4190&ssr=yes&s=xmlBJul 24, 2008 02:11 

Can I get a zip file that contains a working example of both fixes ?

Also, as a separate request, the sorting is based on the xml's having an attribute of "id."  Can the library use an "id" tag instead ?

for example, instead of ...

<zzz>
<z id="1">
<a>0</a>
<b>loaded from xml string</b>
</z>
<z id="2">
<a>1</a>
<b>loaded from xml string</b>
</z>
<z id="3" selected="1">
<a>2</a>
<b>loaded from xml string</b>
</z>
</zzz></textarea>

we have....

<zzz>
<z>
<id>1</id>
<a>0</a>
<b>loaded from xml string</b>
</z>
<z>
<id>2</id>
<a>1</a>
<b>loaded from xml string</b>
</z>
<z>
<id>3</id>
<a>2</a>
<b>loaded from xml string</b>
</z>
</zzz></textarea>
Answer posted by Support on Jul 29, 2008 02:09
Sorry for inconvenience, correct js file attached to email.

>>Also, as a separate request, the sorting is based on the xml's having an attribute of "id."
dhtmlxgrid_data.js , line 62
    var id=rows[i].getAttribute("id");
can be replaced with
    var id=xml.doXPath("./id",rows[i])[0].firstChild.data;
Attachments (1)