当前位置: 代码迷 >> Java相关 >> easyUI中datagrid 将 text 设为不可编辑,该怎么办
  详细解决方案

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

热度:983   发布时间:2016-04-22 21:01:36.0
easyUI中datagrid 将 text 设为不可编辑,该怎么处理
<th data-options="field:'relationship',width:120,editor:{type:'text',options:{disabled : true}}">关系</th>

写disable:true,不行,应为text没有那个属性,,该怎么写??
------解决方案--------------------
editor 就是可编辑的。不可编辑,你就不要用 editor 
$.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);   
             }   
         }   
     }   
 }); 
  相关解决方案