{
field: 'TITLE_CODE',
title: '提問題目',
width: '50%',
halign: 'center',
align: 'center',
sortable: false,
hidden: false,
formatter: function (value, row, index) {
if (row["TITLE_NAME"] == null || row["TITLE_NAME"] == undefined ) {
return row["TITLE_CODE"];
} else {
return row["TITLE_NAME"];
}
},
editor: { type: 'editorCombobox', options: { valueField: 'TITLE_CODE', textField: 'TITLE_NAME', data: questionTitleList, editable: true} }
}
$.extend($.fn.datagrid.defaults.editors, {
editorCombobox: {
init: function (container, options) {
var box = $('<input />').appendTo(container);
box.combobox(options);
return box;
},
getValue: function (target) {
return $(target).combobox('getText');
},
setValue: function (target, value) {
$(target).combobox('setText', value);
},
resize: function (target, width) {
var box = $(target);
box.combobox('resize', width);
},
destroy: function (target) {
$(target).combobox('destroy');
}
}
});
$.extend($.fn.datagrid.defaults.editors, {
text: {
init: function(container, options){
var input = $('<input type="text" class="datagrid-editable-input">').appendTo(container);
return input;
},
getValue: function(target){
return $(target).val();
},
setValue: function(target, value){
$(target).val(value);
},
resize: function(target, width){
var input = $(target);
if ($.boxModel == true){
input.width(width - (input.outerWidth() - input.width()));
} else {
input.width(width);
}
}
}
});