Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by Luigi Barone on Mar 14, 2008 07:02
open dhtmlx forum
Combo in grid builds on the fly

Hi,
I have a grid, dynamically loaded from an xml, where a column is of type "combo". When a cell (in that column) is double-clicked an ajax request is sent to the server. This request returns a list of values that I need to insert/add in the combo.

Is this possible? If yes could you please send me an example?

Many Thanks,
Luigi
Answer posted by Support on Mar 17, 2008 08:21
Does your version of "combo" excell provide getColumnCombo method ?

If no please, contact directly at  support@dhtmlx.com and provide you reg. number. We will send you the new version of the excell and instruction for its using.

The approach which can be used is:  

mygrid.attachEvent("onEditCell",function(stage,row_id,column_index){
       if((stage==0)&&(column_index==1)){
            var combo = mygrid.getColumnCombo(column_index);
            combo.clearAll()
            combo.loadXML(url+"?id="+row_id);
        }
        return true
})
Or if the combo is in an autocomplete mode:

mygrid.attachEvent("onEditCell",function(stage,row_id,column_index){
       if((stage==0)&&(column_index==1)){
            var combo = mygrid.getColumnCombo(column_index);
           combo._xml +=  ((combo._xml.indexOf("?")!=-1)?"&":"?") +"id="+row_id;
        }
        return true
})