I try to create Search box and Create in the toolbar but it doesnot work. Tool bar only accept 1 of them. Any one can help me
答案 0 :(得分:0)
工具栏模板示例显示了如何自定义工具栏。该示例演示了添加刷新图标和搜索框。


您还可以在配置网格后添加搜索框。

&# xA; $('#myGridID .k-grid-toolbar')。append(
'< form id =“searchForm”action =“#”>'
 + '< input class =“k-textbox k-space-right”type =“search”id =“searchTerm”placeholder =“Search term ...”/>< span title =“按名称或地址查找” id =“searchGo”class =“k-icon ki-search”>< / span>'
 +'< / form>'
);
 $( “#searchForm”)提交(onSearchSubmit)&#XA。 $(“#searchGo”)。点击(onSearchSubmit);



 并相应地设置网格过滤器

 
 function onSearchSubmit(e){
 var term,grid,criteria;

 e.preventDefault();

 term = $(“#searchTerm”)。val();
 grid = $(“#myGridID”)。data(“kendoGrid”);
 criteria = {
逻辑:“或”,
过滤器:[
 {field:“Name”,operator:“contains”,value:term},
 {field:“Address”,operator:“contains”,value:term}
 ]};
 if(term ===“”){criteria = null} //没有条件,显示所有记录
 grid.dataSource.filter(条件);
}
 代码>