Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by Rachel Santamaría on Oct 21, 2009 02:05
open dhtmlx forum
onChange coro in grid

Hello!

I have dhtmlxSuite v2.5. I have a grid with the first column type of "coro" and I need capture the event onchange this cell.

---------------
gridLineasFactura = new dhtmlXGridObject("gridbox");
gridLineasFactura.setImagePath("../lib/dhtmlx/imgs/");
gridLineasFactura.init();
gridLineasFactura.setSkin("dhx_black");
gridLineasFactura.loadXML("comercialxml2.php?id=0");
//
var comboLinea = gridLineasFactura.getCombo(0);
comboLinea.attachEvent("onChange",function(){
    alert("hello"); //PROBLEM <-- I never saw it.
});
---------------
<?xml version=\"1.0\" encoding=\"iso-8859-1\"?>
<rows>
<head>;
<column align='left' width='100' sort='str' type='coro'>Artículo
<option value='1'>1</option><option value='2'>2</option><option value='3'>3</option>
</column>
<column align='left' width='*' sort='str' type='txt'>Concepto</column>
</head>
<row id='1'>
<cell>1</cell>
<cell>descripcion</cell>
</row>
</rows>
---------------

The grid shows correctly, but never show the alert of event onchange. Can I do?

Bye,
Rachel
Answer posted by dhxSupport on Oct 21, 2009 02:10
You can use "onEditCell" event. Please find more information here http://dhtmlx.com/dhxdocs/doku.php?id=dhtmlxgrid:event_oneditcell
Answer posted by Rachel Santamaría on Oct 21, 2009 02:16

Hello!

I know that I can use the editcell event, but why can' I use onchange of this cell?

It exists the onchange event in cell coro, then why don't it run?

Thanks.

Rachel

Answer posted by dhxSupport on Oct 21, 2009 02:46
>>It exists the onchange event in cell coro, then why don't it run
dhtmlxGrid hasn't "onChange" event. 
Only dhtmlxCombo extension has "onChange" event. If you want to use in  the grid, you should use "combo" eXcell type (this eXcell type is available in PRO version only).
Please find more information here http://dhtmlx.com/dhxdocs/doku.php?id=dhtmlxgrid:how_to_use_new_excell_combo
If you want attach "onChange" event to the "combo" cell, you should attach it to the dhtmlxCombo object, not to the dhtmlxGrid object.
var combo = grid.getColumnCombo(columnIndex);
combo.attachEvent("onChange",function(){});

Answer posted by Rachel Santamaría on Oct 21, 2009 03:40
Thanks