Please look at this code, which shows how to change the column editor before editing a cell.
$('#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'
});