Dojo中的状态服务器端过滤 [英] Stateful server side filtering in dojo

查看:96
本文介绍了Dojo中的状态服务器端过滤的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在dojo 1.10版本的增强型网格中进行服务器端过滤.在文档中的此处提到使用 isStateful属性.另外,如果我们使用isStateful属性,我们还需要使用URL参数,根据 文档是

I am doing server side filtering in the enhanced grid in dojo 1.10 version. Here in document it is clearly mentioned to use isStateful property. Also, if we use isStateful property we need to use the URL parameter also, which according to documentation is

当isServerSide和isStateful均为true时,如果store.url无法检索服务器url,则可以在此处设置服务器url.

我想知道这里的 store.url 是什么?一世 在其他网站中搜索过,我对url的其他定义来自此处

I want to know how what is here store.url? I have searched in other sites, the other definition I get of url is from here and here

如果使用有状态,则这是发送命令的URL.默认为store.url

任何人都可以提供有关如何使用isStateful属性的简单示例或演示.我在这里很困惑.为此,我们需要服务器端脚本吗?

Can anybody provide a simple example or demo on how to use isStateful property. I am pretty much confused here. Do we need to have server side scripting for this?

推荐答案

require(['dojo/store/JsonRest',
        'gridx/Grid',
        'gridx/core/model/cache/Async',
        'gridx/modules/SingleSort',
        'gridx/modules/pagination/Pagination',
        'gridx/modules/CellWidget',
        'dijit/registry',
        'gridx/modules/Bar',
        'gridx/support/LinkPager',
        'gridx/support/Summary',
        'dojo/domReady!'],function(Store, Grid, Async, Sort, Pagination, CellWidget, registry, Bar, LinkPager, Summary){
    var jsonStore = new Store({
        idProperty: "id", target: <your url>,
                 query: function(query, options) {  
                     var request = {};              
                     /* Paging Params. */
                     if (grid==null) {   
                         /* null on first call to server. */
                         request.currentPage=0;
                         request.pageSize=DEFAULT_PAGE_SIZE;
                     } else {
                         request.currentPage=grid.pagination.currentPage();
                         request.pageSize=grid.pagination.pageSize();
                         if (request.pageSize==-1) {
                             /* Page size is -1 when 'ALL' records selected. Reset */
                              request.pageSize=DEFAULT_PAGE_SIZE;
                        }
                     }
                     /* Sorting Parameters. */
                     if (options.sort == null) {
                         /* null on first render. */
                         request.sortAttribute="id";
                         request.descending=false;
                     } else {
                        request.sortAttribute=options.sort[0].attribute;
                        request.descending=options.sort[0].descending;
                     }
                     var results = Store.prototype.query.call(this, request);   
                     return results;
                 }  
             });
             grid = new Grid({
                 cacheClass: Async,
                 store: jsonStore,
                 structure: <your column definition>,
                 barBottom: [{pluginClass: Summary, style: 'text-align: left;'},{pluginClass: LinkPager, style: 'text-align: right;'}],
                 modules:[Sort, Pagination, Bar, CellWidget]}); 
             grid.pagination.setPageSize(DEFAULT_PAGE_SIZE);
             registry.byId('gridDIV').set('content', grid);
             grid.startup();
         });

这篇关于Dojo中的状态服务器端过滤的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆