Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by paul on Jul 29, 2008 00:30
open dhtmlx forum
how to select an optio for a coro cell programmatically?

Hello!

I'm trying to "pre-select" an option from a combo list in a new created row and I'm wondering how to do this.
It's not a problem to populate an ed-cell with text. But I just don't understand, how to make an option in a coro-cell to be auto-selected. I.e. in the new created row I need the second cell (that is coro typed) the first possible oprion oif combo to be auto-selected.

I would very appreciate your help on this topic.

Thanx!
Answer posted by Support on Jul 29, 2008 01:29
You can use default way to set cell values
    grid.cells(i,j).setValue(some)
The only difference, in case of co|coro excell , you need to use option value, not option label, as parameter

grid.getCombo(1).put("1","One");
...
grid.addRow(nid,["some","1"]); // will result in "some|One"
// or grid.cells(nid,1).setValue("1");
Answer posted by paul on Jul 29, 2008 02:54
Hello!
thanks for info! Unfortunatelly hte values of coro are loaded dynamically, so there is no way to know the "right" value to be selected.

Is there a way to select an option by index? (i.e. "select the first optin avlilable")?

Thanx
Answer posted by paul on Jul 29, 2008 03:02
sorry for bothering you!

I've fount how to do this:

    mygrid.addRow(mygrid.getUID() );
    mygrid.cells(mygrid.getRowsNum()+1, cellIndex).setValue(mygrid.getCombo(coroColumnIndex).keys[0]);