Categories | Question details Back To List | ||||||||||||||
dhtmlxGrid and dhtmlxCombo? Hi, Please help me to keep going. I have a grid with the following column types. mygrid.setColTypes("cntr,combo,dhxCalendarA,mynum,ed,combo,ro,ro"); How can I populate the combo selection which is in 2nd and 6th columns when I am not suppose to use xml file to have the selection items. I need to have this dynamic based on the row. If the row = 1 then combo in the column 1 must be filled with some selected items If the row other than one then the combo will be filled with some other items I have included dhtmlxcombo reference and have the following code but it does not populate the combo. I don't see any items in the selection combo when I click on it. This is how I attach the function to the grid. mygrid.attachEvent("onEditCell",myf); function myf(stage,id,index){ var ind=mygrid.getRowIndex(id); if ((index==1)&&(stage==0))//start edit Shipping column { var combo=mygrid.getCombo(1); if (ind%2==1){ //for even rows combo.save(); //save initial state combo.put(1,"1"); combo.put(1,"2"); combo.put(1,"3"); } else{ combo.save(); //save initial state combo.put(1,"1"); combo.put(1,"2"); combo.put(1,"3"); } } if ((index==1)&&(stage==2)) //for finishing edit mygrid.getCombo(1).restore(); //restore combo state return true; } What is wrong? I have access to a demo but the combo is loading its data from xml file. Thanks, Biju Answer posted by Support on Dec 22, 2008 03:57 There are few different types of combo combo - dhtmlxcombo , useful when you need to load data from external XML co - build in combo of grid The above sample code can be used with "co" column type, so just change mygrid.setColTypes("cntr,combo,dhxCalendarA,mynum,ed,combo,ro,ro"); to the mygrid.setColTypes("cntr,co,dhxCalendarA,mynum,ed,co,ro,ro"); Also , in latest version of dhtmlxgrid you can use more simple approach - please check attached sample. Attachments (1)
Answer posted by Biju on Dec 22, 2008 04:05 I want to have the drop down arrow which is not available with the simple 'combo'. Thanks, Biju Answer posted by Support on Dec 22, 2008 04:11 Please check updated sample Attachments (1)
Answer posted by Biju on Dec 22, 2008 05:36 Thanks for the prompt replay. I will check and get back to you. |