最近使用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 }); } }很簡單吧,能夠用回車鍵觸發搜索函數