您现在的位置是:首页 > 电脑技术查询 > web开发

easyUI中datagrid 将 text 设为不可编辑,该怎么处理

编辑:chaxungu时间:2022-10-02 23:14:39分类:web开发

easyUI中datagrid 将 text 设为不可编辑
在 easyUI 的 datagrid 中, 有editor 为 text 的一个字段
JScript code{field:'price',title:'价格',width:80,editor:'text'}

如何设置这个 text 不能编辑(disabled=true) ?

------解决方案--------------------
JScript code$.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); } } }});