Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by Luke Campbell on Feb 19, 2009 03:21
open dhtmlx forum
IE Issues Displaying Data -- related to <head> tag in data....

My code looks like this:

mygrid = new dhtmlXGridObject('mygrid_container');
     mygrid.setImagePath("dhtmlx/dhtmlxGrid/codebase/imgs/");
     mygrid.setHeader("Property,Value");
     mygrid.setInitWidths("150,*");
     mygrid.enableAutoHeight(true);
     mygrid.setColAlign("left,left")
     mygrid.setSkin("light");
     mygrid.setColSorting("str,str");
     mygrid.setColTypes("ed,ed");
     mygrid.attachEvent("onRowSelect",doOnRowSelected);
     mygrid.enableColumnAutoSize(false);
     mygrid.init();
     theURL = "dhtmlx/test.xml";
     var rand_no = Math.random();
     theURL += "?rnd="+rand_no;
         
     mygrid.loadXML(theURL);

The XML that it loads looks like this:
<?xml version="1.0" encoding="iso-8859-1"?>

<rows>
<head>

        <column type="ed" align="left" sort="str">
        
        </column>
    <column type="ed" align="left" sort="str"></column>
    </head>
            

                         <row id="5001">
                 <cell>LAT</cell>

     <cell>51.5330232</cell>
     </row>
    
                 
</rows>

If you try this, it doesn't seem to work in IE. Strangely, taking out the <head>...</head> tag seems to make it all work. Anyone got any ideas?

Thanks!
Answer posted by Support on Feb 19, 2009 04:05
Grid configuration need to be defined fully in js code or fully in XML code
In your case correct initial values defined in js code, but during XML parsing , component finds the <head> section in XML and drop all previously defined configuration. The configuration provided in XML miss column names and column widths - which result in error. 

What was the purpose of head section in XML when you already have all config in js code ?
Answer posted on Feb 19, 2009 04:10
In this case, we want to be able to specify the values for the combobox.

I was following the examples given in the tutorial -- if I ONLY want to specify the values for the combobox (when I am editing it), could you advise on the best way to achieve this?

Thanks!
Answer posted by Support on Feb 19, 2009 09:46
In common case, configuration of combo-boxes are part of grid's configuration. So if all configuraton defined in XML - combo configuration can be stored there as well. If all configuration done in js code - configuration of combo can be done through js code as well.

mygrid = new dhtmlXGridObject('mygrid_container');
mygrid.setImagePath("dhtmlx/dhtmlxGrid/codebase/imgs/");
...
mygrid.setColTypes("co,ed");
var combo=mygrid.getCombo(0);//0-index of column
combo.put("value 1","label 1")
combo.put("value 2","label 2")
combo.put("value 3","label 3")
...
Answer posted on Feb 20, 2009 01:15
Thanks! That works a treat -- I went down the configuration in the XML route, as this was easiest.