【发布时间】:2011-05-20 08:19:26
【问题描述】:
我正在使用 dojox.grid.EnhancedGrid 的过滤器插件。它的介绍在http://dojotoolkit.org/reference-guide/dojox/grid/EnhancedGrid/plugins/Filter.html#dojox-grid-enhancedgrid-plugins-filter。
为了实现服务器端过滤器,它说:
"默认情况下,服务器端被假定为无状态(REST 风格)。在这种情况下,您应该将过滤器定义与存储的获取请求一起发送到服务器端。您可以通过以下方式执行此操作每次调用 store.fetch 之前修改请求对象。"
并给出了部分示例代码:
var grid = new dojox.grid.EnhancedGrid({
id:"grid",
store:"mystore",
structure:"mystructure",
plugins:{
filter: {
isServerSide: true,
setupFilterQuery: setupFilter
}
}
});
var setupFilter = function(commands, request){
//the commands object here is the same as the POSTed commands object for stateful server, see below.
if(commands.filter && commands.enable){
//some filter is defined and valid. You can modify the request object here.
}else{
//no filter is valid.
}
};
从这个例子中,我仍然不知道如何将过滤器定义传输到服务器端。 commands.filter 是一个像树一样的 json 对象。它如何通过url参数传递到服务器端。谁能给我一些示例代码?
最好的问候 ZY
【问题讨论】: