I see there are several ways to set a column as a combo box.
I have a fairly static table. It’s 3 rows by 9 columns.
I want to have the entire second row as a combo box. Is there a way to do this?
Thanks,
Drew
I see there are several ways to set a column as a combo box.
I have a fairly static table. It’s 3 rows by 9 columns.
I want to have the entire second row as a combo box. Is there a way to do this?
Thanks,
Drew
You should enable combo for each cell in a row (feature works only in PRO version of dhtmlxGrid):
<rows>
<row id="some1">
<cell> some </cell>
<cell> some </cell>
<cell xmlcontent="true">1<option value="1">The first</option><option value="2">The second</option></cell>
<cell> some </cell>
</row>
</rows>
I do have the pro version. Whenever I add the cell that should be a combo, I get an error saying:
SCRIPT438: Object doesn’t support property or method ‘toString’
dhtmlxgridcell.js, line 13 character 53
My XML looks like this:
<?xml version="1.0" encoding="UTF-8"?> NAME Date Time Direction Cost Surname Location Duration Extension FIELD Date Time Direction Cost Surname Location Duration 1The firstThe second AGGREGATE Sum Avg Count None None None None Extensionand is called using:
mygrid = new dhtmlXGridObject(‘gridbox’);
mygrid.setImagePath("…/…/codebase/imgs/");
mygrid.setHeader(",Field 1,Field 2,Field 3,Field 4,Field 5,Field 6,Field 7, Field 8");
mygrid.setInitWidths(“100,,,,,,,,”);
mygrid.setSkin(“dhx_skyblue”);
mygrid.init();
mygrid.loadXML(“xml/testgrid.xml”);
In your grid’s init you have not defined column types.
Please, try to use setColTypes() method:
docs.dhtmlx.com/doku.php?id=dhtm … etcoltypes
And use “co” or “coro” for combo column.
But that’s the thing… I don’t want the entire column to be a combo.
I want an entire row to be a combo.
The other two fields in this column I did not want to be combos.
The cell or the column should have any defined type.
For a cell:
1The firstThe second
Worked perfectly… thank you so much for your prompt response.
New Question… I must be missing something.
When loading my embeded combo how do I specify (through XML) which combo value is selected by default. I have tried
selected=“selected”
and selected=“1”
but neither seem to work.
SURNAME FIRST NAME SURNAME AND FIRST NAME DATESelected value should be defined as a value of a cell:
DATE
SURNAME FIRST NAME SURNAME AND FIRST NAME DATESometimes the easy solutions are the hardest to find.
Thanks again for your quick response.
This forum is great!
One last question.
It would appear as though when I click on the cell, it creates a new entry at the bottom. So in the example below I actually get two “SURNAME” entries in my dropdown list. How do I ensure it selelcts the SURNAME in the list and does not create a new one.
SURNAME
SURNAME FIRST NAME SURNAME AND FIRST NAME DATEThanks again,
Drew
Please, make sure that the value in the cell is equal to the value defined in options.
Make sure that there is no spaces before/after the value, or lowercase/uppercase characters are equal.
I think I figured out the problem but can’t seem to figure out the solution.
If I define a grid cell like this
The first
The first The secondEverything works the way it should. When the user clicks the cell it show the right one. This seems to only work if the cell value is equal to the data. My challenge is that I need to specify a value that is not the same as the option text.
Example:
The first
When I do this, the text “The first” is added to the bottom of the dropdown. Is there a way to specify the value of the default text to ensure it is selected properly?
Nevermind, I figured it out.
I didn’t realize that the string after the cell tag would match based on ID. The example below does what I need it to.
[The second]
The first The secondRookie mistake I’m sure.
Thanks anyway
Drew