html 部分
主要是这句话 <th data-options=“field:‘attr1’,width:250,editor:{type:‘searchbox’}”>Attribute</th>
js部分
.
e
x
t
e
n
d
(
.extend(
.extend(.fn.datagrid.defaults.editors, {
searchbox: {
init: function(container, options) {
var input = $(’<input type=“text” class=“easyui-textbox”>’).appendTo(container);
).appendTo(container);
input.textbox({
//添加清除图标
icons: [{
iconCls: ‘icon-clear’,
handler: function (e) {
input.textbox(‘clear’);
//modelTextClear(curField);
}
},
{
iconCls:‘icon-search’,
handler: function(e){
var v = $(e.data.target).textbox(‘getValue’);
alert('The inputed value is ’ + (v ? v : ‘empty’));
}
}
]
});
return input;
},
getValue: function(target) {
return $(target).searchbox(‘getValue’);
},
setValue: function(target, value) {
$(target).searchbox(‘setValue’, value);
},
resize: function(target, width) {
$(target).searchbox(‘resize’, width);
}
}
});