最近使用easyui,发现datagrid默认toolbar没有搜索输入栏,经过反复实验终于添加上了,分享给各位。先上图看一下效果
$("<td style='padding: 0 8px;'><input class='easyui-searchbox' style='width: 200px;' " +
"prompt='请输入姓名或拼音查询' searcher='person.search'></td>").
prependTo(".datagrid-toolbar table tbody tr");
var person = {
search: function (value) {
$("#personList").datagrid("load", {
index: value
});
}
}
很简单吧,可以用回车键触发搜索函数