Hi,
I have a combo column in grid. If combo list don’t have values (empty) then sent a message
alert. How make this? and is correct put in event onEditCell?
Thanks for your help.
Regards.
In case of using co/coro selct you may use getKeys() method to get all values of the combo list:
combo = mygrid.getCombo(col_ind);
val=combo.getKeys() // array with the options
Hi sematik,
I use a combo setColTypes. This combo is formed with information extracted from database, when not bring values, I need inform message the user, don’t have empty. I did not find the object or instruction with which to do this. As I understood getKeys () applies only to co / coro. There is another way to fix this? Thanks for your help.
In case of using the “combo” exCell you may try to use the following:
combo = grid.getColumnCombo(columnIndex);
combo.getOptionByIndex(0).value // returns “1” if at least one option is in the grid, else null
Hi sematik,
I test combo = grid.getColumnCombo(columnIndex);
combo.getOptionByIndex(0).value // returns “1” if at least one option is in the grid, else null
When combo have values, combo.getOptionByIndex(0).value return first value of list, but when
combo have empty values this instruccion mark next error:
Uncaught TypeError: Cannot read property ‘value’ of undefined
I think that object don’t applicatte .value because don’t have nothing.
How solution this?
Thanks for your help.
Regards.
I apologize.
This method will return the value of the first option of the combo.
If there is no options in the combo it will return null.
If issue still occurs - please, provide any kind of sample of your code to reproduce the issue.
Hi,
Thanks for your help.
In my html file define
mygrid.setColTypes(“ed,combo,ed”);
Then add onEditCell event with attach code.
Regards.
example.zip (8.71 KB)
Unfortunately the pointed error is not occurs for us.
If issue still occurs - please, provide a more detailed sample, or a complete demo where the issue can be reconstructed.
The following code works well for us:
[code]mygrid.attachEvent(“onEditCell”,function(stage,rowId){
if(stage == 2)
{
comboPaq = mygrid.getColumnCombo(1);
var option= comboPaq.getOptionByIndex(0);
var valor = option.value;
alert("valor" + valor);
if (valor == "")
{
alert("La lista no puede ser vacia");
}
} // if stage = 2
});[/code]