Load combo in grid

Hi,



My Grid needs to have a combobox and the data in the combo box needs to be loaded from another database table.

The combo should diaplay a single field and another hiden field value needs to be set in the grid while selecting a value from combo.



Can any body please let me know how to implement it?



Thanks and Regards,

Pravu Mishra.


hello,


there are co (combobox), coro (read-only co) and combo (the implementation of dhtmlxCombo, only PRO edition) excells that can be used in grid.


Options of these excells have both keys and values. Values are displayed, you can see them in combo and grid when an option is selected. Keys are hidden. When the option is selected, its key is set as a value of the grid cell (the data that goes to the server and available by getValue() method), but grid cell shows option value.


The examples are dhtmlxGrid/samples/cell_types/pro_maxlength.html and dhtmlxGrid/samples/interaction_other_components/pro_combo.html


Hi,



I used like the following to create combobox in a grid.



1111
 



Now I found there is little performance problem . The screen takes more time to display  records. This implementation adds same combo data in each record and hence takes more time in data transfer from server to client.



Is there any alternative way of implementation which is not going to create any performance problem.



 



Thanks and Regards,



Pravu Mishra.



 


Hello


which grid version do you use ? The latest grid allows to set combo for the whole column:


Column name
one…


Also you can use co or coro type:


Column name
one




You can also define column options by the script:


- for combo type:


var combo = grid.getColumnCombo(column_index);
combo.addOption([[key1,value1],[key2,value2],…]);


- for co or coro:


grid.getCombo(column_index).put(key,value);










Hi,




I am using “dhtmlxTreeGrid Enterprise License” version and I tried according to your suggestion, used column type as “co” and it is working. But when I changed the column type to 'combo" it says known column type.



I added the header part (grid properties) in the xml and I did not set the combo properties like name, size, column type in the java script.



Could you please let me know whether the version I use does not support “combo” or there is some change I need to do .



Thanks and Regards,



pravu Mishra.

Please check that you’ve included dhtmlxgrid_excell_combo.js to use combo excell.


Hi Alex,



I included dhtmlxgrid_excell_combo.js  file and now it is not saying known column type but the values inside the combo are not getting displayed.



The header part is working for “co” and all the values are getting diaplayed inside the box.



In side the header part for the grid I just changed the ‘co’ to “combo’ and included the dhtmlxgrid_excell_combo.js   file in the  HTML file.



Following is part of  my java code that generates the header part.



out.append(”<column width="*" type=“combo” align=“left” filter=“true” sort=“str”>Branch");
out.append(fetchComboValues());
out.append("");







private String fetchComboValues(){



 while (rs.next()){
  String taskid = rs.getString(“taskid”);
  out.append("<option value="" + taskid+ “”>" + taskid +"");
  …
  }





return combo,
}



is there any thing more I need to do while changing from “co” to “combo”?



Thanks and Regards,



Pravu Mishra.



 



 


Hello,


please add also xmlcontent=“1” attribute to the combo column tag:


out.append("<column width="*" type=“combo” align=“left” filter=“true” sort=“str” xmlcontent=“1”>Branch");


Hi Alex,



I added xmlcontent=“1” attribute to the combo column tag but it does not display the the values in the combo.



Is there any thing else I should try?



Thanks and Regards,



pravu Mishra.



 


Please, check that dhtmlxcombo libararies are included (.js and .css files).


Please, take a look at the sample in the grid package dhtmlxGrid/samples/interaction_other_components/pro_combo.html