Categories | Question details Back To List | ||
Combobox in Grid Hello, Should I be using 'co' or 'combo' as the excell type for a combobox in a grid? Also, how can I get the value not the label for a combobox in a grid? I am using grid.cells(rowId, cellInd).getValue() but it does not give the true value, but instead the label. Thanks, Martin Answer posted by dhxSupport on May 29, 2009 06:14 To implement combobox in the grid you can use "co", "coro" or "combo" eXcell types. "combo" eXcell type is a integrated dhtmlxCombo, this eXcell type is availibe in PRO version only. Please see more information about implementin combobox in the grid here http://www.dhtmlx.com/docs/products/dhtmlxGrid/doc/articles/Managing_selectbox_coll.html#grid_sboxman http://www.dhtmlx.com/docs/products/dhtmlxGrid/doc/articles/Combo_excell.html#grid_art_comboexcell http://www.dhtmlx.com/docs/products/dhtmlxGrid/doc/new_1_3.html#grid_intcombo To get label from the "combo" cell you can use method grid.cells(rowId, cellInd).getText() Answer posted by Martin Allchin on May 29, 2009 06:37 Thank you for the reply. I have the enterprise edition (2.0 I think) but when I try excell type 'combo' I get the error "Incorrect cell type: combo". You answered how to get the label, but I need the value. I am defining the options for the combo in XML as per the documentation, and am doing <option value="foo">bar</option>, but I get 'bar' not 'foo' using getValue(). How come? Thanks, Martin Answer posted by Martin Allchin on May 29, 2009 07:34 This person also says getValue() returns the label not the value: http://www.dhtmlx.com/docs/products/kb/index.shtml?cat=search&page=1&q=3950&ssr=yes&s=grid%20coro%20getvalue That bug is from mid-2007, do you know if it has been fixed please? Answer posted by dhxSupport on May 29, 2009 07:58 >>I have the enterprise edition (2.0 I think) but when I try excell type 'combo' I get the error "Incorrect cell type: combo". To use that cell type you should include files: “excells/dhtmlxgrid_excell_combo.js” from the dhtmlxGrid pagckage “codebase/dhtmlxcombo.js”, “codebase/dhtmlxcombo.css” from the dhtmlxCombo package >>Also, how can I get the value not the label for a combobox in a grid? I am using grid.cells(rowId, cellInd).getValue() but it does not give the true value, but instead the label. Unfortunately we cannot reproduce this issue locally. Please provide use sample where we this issue occurs. Answer posted by Martin Allchin on May 29, 2009 08:04 >> >>I have the enterprise edition (2.0 I think) but when I try
excell type 'combo' I get the error "Incorrect cell type: combo". >>To use that cell type you should include files: >>“excells/dhtmlxgrid_excell_combo.js” from the dhtmlxGrid pagckage >>“codebase/dhtmlxcombo.js”, “codebase/dhtmlxcombo.css” from the dhtmlxCombo package I am using the all-in-one javascript file. I assume this has everything I need? In which case, still doesn't work :-( >> >>Also, how can I get the value not the label for a combobox in a grid? I am using grid.cells(rowId, cellInd).getValue() but it does not give the true value, but instead the label. >>Unfortunately we cannot reproduce this issue locally. Please provide use sample where we this issue occurs. The link in my previous post shows someone with the same issue. Both getTitle() and getValue() return the label not the value. I will try and re-produce and get back to you. Answer posted by dhxSupport on May 29, 2009 08:19 >>I am using the all-in-one javascript file. I assume this has everything I need? In which case, still doesn't work :-( Do you use dhtmlxSuite version of all-in-one file? If not, you should compile new file including dhtmlxCombo package. >>The link in my previous post shows someone with the same issue. Both getTitle() and getValue() return the label not the value. Please send us example or xml sourse which you are using. Answer posted by Martin Allchin on May 29, 2009 08:21 I have tried to re-produce the problem but it works as expected in the simple example I have created. I don't think it is a bug in my code and I am using the same methods and includes in the simple example and my non-working version. I will try and deduce further. Answer posted by Martin Allchin on May 29, 2009 08:24 Just noticed your reply, please see last post too :) >> >>I am using the all-in-one javascript file. I assume this has everything I need? In which case, still doesn't work :-( >>Do you use dhtmlxSuite version of all-in-one file? If not, you should compile new file including dhtmlxCombo package. Yes I am using the dhtmlxSuite version bundled with the Enterprise download. >> >>The link in my previous post shows someone with the same issue. Both getTitle() and getValue() return the label not the value. >>Please send us example or xml sourse which you are using. I have just tested the XML source with another, simpler example and it works as expected. I suspect the issue is in my javascript, or the way in which I am using dhtmlx components togethers. I have a dhtmlxWindow -> dhtmlxLayout -> dhtmlxGrid -> dhtmlxCombo. Answer posted by Martin Allchin on May 29, 2009 08:32 Please check previous posts, I've posted 2-3 replies since your last :) I have created a window and am attaching a layout to it, and adding a grid, using the following code: // attach layout ajaxExt_NumMapLayout = ajaxExt_NumMapWindow.attachLayout('3E', 'dhx_blue'); // cell a ajaxExt_NumMapLayout.cells('a').hideHeader(); ajaxExt_NumMapLayout.cells('a').setHeight(70); var url='ajaxExt_NumMapWindow.php?cell=a'; ajaxExt_NumMapLayout.cells('a').attachURL(url); // cell b ajaxExt_NumMapLayout.cells('b').hideHeader(); ajaxExt_NumMapGrid = ajaxExt_NumMapLayout.cells('b').attachGrid(); ajaxExt_NumMapGrid.setImagePath('/3rdparty/dhtmlx/imgs/'); ajaxExt_NumMapGrid.enableMultiselect(false); ajaxExt_NumMapGrid.setSkin('light'); ajaxExt_NumMapGrid.preventIECaching(true); ajaxExt_NumMapGrid.init(); var url='ajaxExt_NumMapWindow.php?cell=b'; ajaxExt_NumMapGrid.loadXML(url); // cell c ajaxExt_NumMapLayout.cells('c').hideHeader(); ajaxExt_NumMapLayout.cells('c').setHeight(20); var url='ajaxExt_NumMapWindow.php?cell=c'; ajaxExt_NumMapLayout.cells('c').attachURL(url); As you can see I am attaching the grid to cell b. This code gives the label if I do getValue(). And here I have created a simple example using the same XML source, but this one works: myGrid = new dhtmlXGridObject('myGridContainer'); myGrid.setImagePath('/3rdparty/dhtmlx/imgs/'); myGrid.enableMultiselect(false); myGrid.setSkin('light'); myGrid.preventIECaching(true); myGrid.init(); var url='ajaxExt_NumMapWindow.php?cell=b'; myGrid.loadXML(url); As you can see, they're almost the same, and use the same XML source, but this one works (getValue() gives the proper value)...? Answer posted by dhxSupport on May 29, 2009 09:07 >>Yes I am using the dhtmlxSuite version bundled with the Enterprise download. Which version of dhtmlxSuite do you use? >>As you can see I am attaching the grid to cell b. This code gives the label if I do getValue(). We tested that code and issue doesnt appear. When you are calling getValue() method? Could you please provide us working and not working samples? Also please send us sample of xml which you are using Answer posted on Jun 01, 2009 01:28 >>Yes I am using the dhtmlxSuite version bundled with the Enterprise download. >Which version of dhtmlxSuite do you use? The download was named dhtmlxSuite_2008Rel3_pro_81009.zip. >>As you can see I am attaching the grid to cell b. This code gives the label if I do getValue(). >We tested that code and issue doesnt appear. When you are calling getValue() method? Could you please provide us working and not working samples? Also please send us sample of xml which you are using I will have to put together a non-working example I am able to send across. I will do this now and email you shortly Thank you. Answer posted by Martin Allchin on Jun 01, 2009 03:32 I have found the cause of the bug and have a working example, what email shall I send to please? The bug is due to setting column types to read-only. After running setColTypes() the grid no longer returns the correct values. Answer posted by dhxSupport on Jun 01, 2009 05:12 Please send example to the support@dhtmlx.com Answer posted by Martin Allchin on Jun 01, 2009 08:31 Sent. Answer posted by Martin Allchin on Jun 02, 2009 06:46 Ahaa, thanks. I will use the disabled method instead, perfect. Thank you for your help! |