Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by Tejas Shah on Sep 10, 2008 06:04
open dhtmlx forum
DHX Grid : How to get the selected combobox value.

Hi there,
How can I get the selected value in the combo box present in the grid. ?????
Answer posted by Support on Sep 10, 2008 06:34
for co|coro cell types
   grid.cells(id,ind).getValue() - value of selected option
   grid.cells(id,ind).getTitle() - label of selected option
Answer posted by Tejas Shah on Sep 11, 2008 00:05
Hi there,
             I am still not able to get the selected value in the combobox, it shows the whole html tags of select.
             Actually I have embedded the select tag in the cell while constructing the XML.
             How to do this ?
Answer posted by Support on Sep 11, 2008 02:58
The code above related to the co|coro excells. 
If you embed custom HTML in grid's cell, you can locate container HTML tag as
   grid.cells(id,ind).cell
and use any necessary DOM manipulations from this point.

Most probably it will look as
   grid.cells(id,ind).cell.firstChild.value
Answer posted by Ramakrishna on Oct 16, 2008 23:08
Hi,
Just like we get the value of the combo box, How we can set the value to the combobox in Grid where combobox is embedded in XML itself and not thru DHX. ???
Answer posted by Support on Oct 17, 2008 03:20
The grid provides unified way to set data for any cell type
   grid.cells(id,ind).setValue(new_value)
This will work for any type of combo, supported by grid ("co","coro","combo")

If you are using custom HTML solution the 
  grid.cells(id,ind).cell
will give access to HTML element of cell, and you need to use DOM methods to access the necessary element and change its value
Answer posted by Ramakrishna on Nov 16, 2008 21:54
Hi,
How to keep one of the items present in the combobox as selected by default ??
Answer posted by Support on Nov 17, 2008 04:53
The current value of cell will be preselected on combo opening , there is no way to have different option preselected ( unless you will use tricky manipulations from onEditCell event handler ) 
Answer posted by Tejas Shah on Nov 17, 2008 05:09
Hi there,
             Can you gimme some example ??
Answer posted by Support on Nov 17, 2008 06:34
from onEditCell stage 1 , it is possible to access the select object as grid.editor.list, and use any DOM methods to change its state. 

Answer posted by Rajakrishna on Nov 26, 2008 03:00
Hi,

I want to set the value to the combobox(HTML Combobox, not DHX) written in XML creation.
I used following

<gridObject>.cells(rowId,cellIndex).cell.firstChild.setValue(1)

It works fine in Mozilla FF, but not in IE6 and 7. Why ?
Answer posted by Support on Nov 26, 2008 07:12
If it is a native select box control , then the valid code will be
            <gridObject>.cells(rowId,cellIndex).cell.firstChild.value=1;