I have a grid with up to 25 columns, each of which has a combo box in the cell. When the grid gets displayed I would like to make a dynamic request back to the server to get the combo box options and then populate all of the combo boxes in each row and cell.
Thanks
Dan
grid.loadXML(url,function(){
//after load
var combo=grid.getColumnCombo(0); //get first combo
combo.loadXML(some_url,function(){ //load data in it
for (var i=1; i<grid.getColumnsNum(); i++){ //when loaded, for all other combos
var combo=grid.getColumnCombo(i);
combo.loadXMLString(this.xmlDoc.responseText); // load the same data
}
})
});
Thanks very much! Looks like it should work. I am using grid version 1.3 so it appears that I will have to upgrade in order to take advantage of this solution…
Described scenario will work for “combo” type of column, which is not available in your version of grid.
You can use more rough approach
grid.loadXML(url,function(){
(new dtmlXMLLoaderObject(function(a,b,c,d,xml){
var options=xml.doXPath("//option");
for (var i=0; i<grid.getColumnsNum(); i++){ //when loaded, for all other combos
var combo=grid.getCombo(i);
for (var j=0; j<options.length; j++)
combo.put(options[j].getAttribute(“value”),options[j].firstChild.data);
}
},this,true,true)).loadXML(“combo.xml”);
})