标签:false debugger idt validate als define length edit margin
1.columns列[一個單元格] 添加combobox下拉選項
$("#userGrid").datagrid({
singleSelect: true,
onClickCell: function (index, field, value) {
//Field = field;
// var rows = $(‘#‘ + UserGrid).datagrid(‘getRows‘); //获得所有行
// var row = rows[index]; //根据index获得其中一行。
// WorkidValue = row.Workid;
debugger
if (client.endEditing()) { //endEditing:自定義方法
$(‘#‘ + UserGrid).datagrid(‘selectRow‘, index)
.datagrid(‘editCell‘, { index: index, field: field }); //editCell:自定義方法
editIndex = index; //editIndex:全局變量
}
},
columns: [[ {
field: ‘Name‘,
title: ‘排班出勤‘,
width: 80,
align: ‘center‘,
editor: {type: ‘combobox‘,options: {}}
sortable: true
//hidden:hidden
}]]
});
endEditing: function () {
if (editIndex == undefined) { return true }
if ($(‘#‘ + UserGrid).datagrid(‘validateRow‘, editIndex)) {
$(‘#‘ + UserGrid).datagrid(‘endEdit‘, editIndex);
editIndex = undefined;
return true;
}
else {
return false;
}
},
//userGrid單行編輯點擊事件
$.extend($.fn.datagrid.methods, {
editCell: function (jq, param) {
return jq.each(function () {
var opts = $(this).datagrid(‘options‘);
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.editor1 = col.editor;
if (fields[i] != param.field) {
col.editor = null;
}
}
$(this).datagrid(‘beginEdit‘, param.index);
for (var i = 0; i < fields.length; i++) {
var col = $(this).datagrid(‘getColumnOption‘, fields[i]);
col.editor = col.editor1;
}
});
}
});
EasyUi datagrid(onClickCell:用户单击一个单元格时触发 ) 單擊編輯 editor:{type: 'combobox'}
标签:false debugger idt validate als define length edit margin
原文地址:https://www.cnblogs.com/popo1/p/12603922.html