Please listen to the 'onBeforeEdit' event, change the 'editor' property value conditionally.
$('#dg').datagrid({
onBeforeEdit: function(index,row){
var col = $(this).datagrid('getColumnOption', 'attr1');
col.editor = {
type:'textbox',
options:{
}
}
}
})