EasyUI Forum

General Category => EasyUI for jQuery => Topic started by: squidoz on January 18, 2022, 03:42:27 AM



Title: Datagrid editor - combobox onClick event
Post by: squidoz on January 18, 2022, 03:42:27 AM
Is it possible to have a datagrid fire an onClick event for the table editor when the combobox selects a record?
I would ideally like to access the record parameter like when using the combobox onClick event to access data to populate other fields?

Table definition
Code:
<table id="dg_plants" class="easyui-datagrid" name="dg_plants" title="Plants" toolbar="#tbr_plants" data-options="singleSelect:true, onClickCell:onClickCell, onEndEdit:onEndEdit, onBeforeEdit:onBeforeEdit, onAfterEdit:onAfterEdit, onCancelEdit:onCancelEdit" style="height:200px; width:100%" >
<thead>
<tr>
<th data-options="field:'plantqty',width:60,align:'right',editor:{type:'numberspinner',options:{precision:0, min:1}}">Qty</th>
<th data-options="field:'plantid',width:220,
formatter:function(value,row){                                             
return row.stockdesc;
},
editor:{
type:'combobox',
options:{
valueField:'stockid',
textField:'stockdesc',
limitToList:true,
url:'lib/src/_getstocksetup.php?catagoryid=1',
required:true
}
}">Plant</th>
<th data-options="field:'plantprice',width:70,align:'right',editor:{type:'numberbox',options:{precision:2}}">Price</th>
<th data-options="field:'plant_unitcost', hidden:true">Unit</th>
</tr>
</thead>
</table>


Javascript
Code:
$('#dg_plants').datagrid({	
onClickRow:function(index,row){
var ed = $(this).datagrid('getEditor', {index:editIndex, field:'plantid'});
$(ed.target).combobox('textbox').bind('onClick',function(row){
alert("Record clicked");
/*
}
$(this).datagrid('beginEdit', index);
}
});