Hi
I have been trying to bind a combo to a grid column with no success, all the examples only show Xml script and I am trying to do it through Javascript.
My grid data is loaded with a Javascript array. I would like to create a combo with array data and bind that to a column in the grid.
Any help on this would be much appreciated, here is what I have sofar:
window.onload = function () {
doOnLoad();
myGrid.clearAll();
myGrid.parse(data,"jsarray");
};
function doOnLoad(){
var myCombo = new dhtmlXCombo("mycombo", "alfa3", 200);
myCombo.setTemplate({
input: "#capital#",
option: "#capital# - #country#"
});
myCombo.addOption(
"1", // option value
{ country: "Finland", capital: "Helsinki" }, // text
null, // custom css, if any css, img, selected
"finland.png", // img, if there are any
true // true, if select after add
);
myCombo.addOption(
"1", // option value
{ country: "Norway", capital: "Oslo" }, // text
null, // custom css, if any css, img, selected
"finland.png", // img, if there are any
true // true, if select after add
);
myGrid = new dhtmlXGridObject('gridbox');
myGrid.setImagePath("assets/grids/EXjS/codebase/imgs/");
myGrid.setHeader("Sales, Book Title, Author");
myGrid.setInitWidths("70,250,*");
myGrid.setColAlign("right,left,left");
myGrid.setColTypes("combo,ed,ed");
myGrid.init();
}
<div id="gridbox" style="width:500px; height:350px; background-color:white;"></div>
<div id="mycombo"></div>