i m使用dhtmlx调度程序。我想根据搜索条件显示事件。我编码用于过滤事件bt bt我无法从数据库中获得combobox中的事件名称。我如何从首页上的mySQL检索事件名称。
我用于过滤事件的代码
scheduler.filter_week = function(id, event)
{
if(event.name == 'New event')
return false; // event will be filtered (not rendered)
//or
return true; // event will be rendered
}
如何检索事件名称?有任何建议吗?
如果您需要服务器端搜索,则每次搜索值都更改
,必须重新加载调度程序事件function search(value){
scheduler.clearAll();
scheduler.load("data source url" + "?search=" + encodeURIComponent(value));
//you may need to handle scenario when user has already typed some other criteria, by the time data is loaded
}
并根据"搜索"请求参数在服务器上进行适当的搜索。如果使用这种方法,则可能不需要客户端过滤器。
但是,如果最初将所有事件加载到页面,客户端搜索可能会更快地响应,因为用户不必等到加载每个新的数据。
function search(value){
scheduler.filter_week = function(id, event){
var haystack = (event.name || "").toLowerCase(),
needle = (value || "").toLowerCase();
return haystack.indexOf(needle) != -1;
}
scheduler.setCurrentView();
}