Categories | Question details Back To List | ||
Grid: Options in combo box I am loading the configuration of the Grid in XML, including the options to be shown on the select box (coro) of a particular column, but depending on the data some options should not be available for some rows. Ideally, the non-available options should not be shown... Is this possible? If not then I guess I will have to build in a validator to determine whether the selection is valid. Any other ideas? Thank you! Answer posted on Oct 24, 2007 05:51 There are two ways to implement required behavior a) You can change list of options dynamically while starting edit operation http://dhtmlx.com/docs/products/dhtmlxGrid/samples/cell_types/pro_dynamic_combo.html or b) You can define separate options list for different rows. ( while it not included in official list of supported features latest version allow to define it in XML as <row id="some"> <cell>value <option value="1">1</option> <option value="2">2</option> <option value="3">3</option> </cell> </row> Answer posted by Dan East on Feb 08, 2008 05:46 I have the latest version of dhtmlxgrid (dated in 2008), but this is not working for me. The only option that appears for the cell is the cell's value. <row id="4"> <cell>Status:</cell> <cell type="coro"> 1 <option value="0">Inactive</option> <option value="1">Active</option> </cell> </row> I've also tried using the text "Inactive" or "Active" for the cell's value, but I get the same result - the only option that appears in the list is the exact value of the cell. Answer posted by Support on Feb 08, 2008 07:36 Please try to use <row id="4"> <cell>Status:</cell> <cell type="coro" xmlcontent="1">1<option value="0">Inactive</option> <option value="1">Active</option> </cell> </row> Answer posted by Dan East on Feb 08, 2008 07:59 Thanks. That works, but I cannot figure out how to select an item in the list. This results in the cell displaying "1", and the option "1" appended to (and selected) the end of the list. I would assume this would be the correct method. <row id="4"> <cell>Status:</cell> <cell type="coro" xmlcontent="1"> 1 <option value="0">Inactive</option> <option value="1">Active</option> </cell> </row> This results in the correct text displayed for the cell, but when I pull up the option list it contains an extra "Active" option at the end of the list, which is selected. <row id="4"> <cell>Status:</cell> <cell type="coro" xmlcontent="1"> Active <option value="0">Inactive</option> <option value="1">Active</option> </cell> </row> I've tried a couple other things to no avail, but cannot pre-select a specific option. Answer posted by Support on Feb 08, 2008 08:03 The problem is that value taken from XML without triming <cell type="coro" xmlcontent="1"> 1 <option value="0">Inactive</option> <option value="1">Active</option> value of cell taken as " 1 " - whitespaces around digit taken in account, there is no related option, so "Active" not shown <cell type="coro" xmlcontent="1">1<option value="0">Inactive</option> <option value="1">Active</option> value of cell taken as "1" - there is option with exactly the same value and "Active" correctly shown |