EasyUI Forum

General Category => EasyUI for jQuery => Topic started by: devnull on June 01, 2016, 09:42:20 PM



Title: Datagrid Cell Edit - Different Editor for Different Rows
Post by: devnull on June 01, 2016, 09:42:20 PM
I have a requirement where the first row of a datagrid needs to record date/time and all of the other rows use a text editor.

is this possible ?


Title: Re: Datagrid Cell Edit - Different Editor for Different Rows
Post by: stworthy on June 01, 2016, 11:34:51 PM
Please look at this code, which shows how to change the column editor before editing a cell.
Code:
$('#dg').datagrid({
data: data,
onBeforeCellEdit: function(index,field){
var col = $(this).datagrid('getColumnOption', field);
if (index==0){
if (field=='productid'){
col.editor = 'datebox';
}
} else {
if (field=='productid'){
col.editor = 'textbox';
}
}
}
}).datagrid('enableCellEditing').datagrid('gotoCell', {
index: 0,
field: 'productid'
});