Categories | Question details Back To List | ||
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. Answer posted by Alex (support) on Jul 16, 2009 02:06 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 Answer posted by pravu Mishra on Jul 16, 2009 07:39 Hi, I used like the following to create combobox in a grid. <cell xmlcontent="1" editable="0"> 11<option value=11>11</option> 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.
Answer posted by Alex (support) on Jul 17, 2009 01:13 Hello which grid version do you use ? The latest grid allows to set combo for the whole column: <column width="100" type="combo" xmlcontent="1">Column name Also you can use co or coro type: <column width="100" type="co">Column name You can also define column options by the script: - for combo type: var combo = grid.getColumnCombo(column_index); - for co or coro: grid.getCombo(column_index).put(key,value); Answer posted by Pravu Mishra on Jul 17, 2009 05:21 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. Answer posted by Alex (support) on Jul 17, 2009 09:25 Please check that you've included dhtmlxgrid_excell_combo.js to use combo excell. Answer posted by Pravu Mishra on Jul 19, 2009 23:14 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"); ... private String fetchComboValues(){ return combo, is there any thing more I need to do while changing from "co" to "combo"? Thanks and Regards, Pravu Mishra.
Answer posted by Alex (support) on Jul 20, 2009 02:40 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"); Answer posted by Pravu Mishra on Jul 20, 2009 03:46 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.
Answer posted by Alex (support) on Jul 20, 2009 03:54 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 |