//-----------------------------------------------------------------
/*************************************************************
*@呼叫方法:{onClickCell:MCBaseDBGrid.DefaultCell}
*@功能: Datagrid擴充套件方法onClickCell{easyui-datagrid-擴充-支援單元格編輯}
*@date: 2016-10-25
*@user; hwm
**************************************************************/
MCBaseDBGrid.DefaultCell = function (index, field, value) {
MCBaseDBGrid.CustomClickCell(this, index, field, value);
}
//-----------------------------------------------------------------
/*************************************************************
*@呼叫方法:《 onClickCell:function (this index, field, value){MCBaseDBGrid.CustomClickCell(this,index, field, value)} 》
*@功能: Datagrid擴充套件方法onClickCell{easyui-datagrid-擴充-支援單元格編輯}
*@date: 2016-10-25
*@user; hwm
**************************************************************/
MCBaseDBGrid.CustomClickCell = function (_this, index, field, value) {
var isfind = false;
if (MCBaseDBGrid.editIndex != -1) {
$(_this).datagrid('endEdit', MCBaseDBGrid.editIndex);
}
var fields = $(_this).datagrid('getColumnFields', true).concat($(_this).datagrid('getColumnFields'));
for (var i = 0; i < fields.length; i++) {
var col = $(_this).datagrid('getColumnOption', fields[i]);
col._editor_bak = col.editor;
if (fields[i] == field && (col.editor != undefined)) {
isfind = true;
}
if (fields[i] != field) {
col.editor = undefined;
}
}
if (isfind == false) {
$(_this).datagrid('endEdit', MCBaseDBGrid.editIndex);
}
else {
$(_this).datagrid('beginEdit', index);
MCBaseDBGrid.editIndex = index;
var ed = $(_this).datagrid('getEditor', { index: index, field: field });//獲取編輯屬性
if (ed) {
if ($(ed.target).hasClass('textbox-f')) {
$(ed.target).textbox('textbox').focus();
$(ed.target).textbox('textbox').select();
} else if ($(ed.target).hasClass('combogrid-editable-input')) {
$(ed.target).parent().find(".combo-text").focus();
$(ed.target).parent().find(".combo-text").select();
} else {
$(ed.target).focus();
$(ed.target).select();
}
}
}
for (var i = 0; i < fields.length; i++) {
var col = $(_this).datagrid('getColumnOption', fields[i]);
col.editor = col._editor_bak;
}
}