【问题标题】:Primefaces 5.0 datascroller and paginationPrimefaces 5.0 数据滚动和分页
【发布时间】:2014-06-11 16:36:14
【问题描述】:

我有一个 primefaces 数据滚动器,用于显示一个简单的列表和一组可以过滤该列表的过滤器。

一切都在 RequestScoped bean 上,我试图避免查看/会话 bean,因为它是一个 b2c 站点,应该有很多访问者。

我的问题是,当我过滤列表时一切正常,但是当我向下滚动时,过滤器状态丢失(过滤器未在 bean 中设置)。

我几乎可以肯定,这是因为 datascroller 正在使用部分进程 (javax.faces.partial.execute),因此不会处理过滤器……但 datascroller 没有相应的选项。有什么想法吗?

谢谢

【问题讨论】:

    标签: java jsf-2 primefaces


    【解决方案1】:

    我终于以又快又脏的方式做到了。 Datascroller 似乎没有发送额外参数的选项。

    (我更改了加载函数,因此进程发送 @all 而不是 this.id )

        PF('datascroll').load= function() {
        this.loading = true;
        this.cfg.offset += this.cfg.chunkSize;
        this.loadStatus.appendTo(this.loaderContainer);
        if (this.loadTrigger) {
            this.loadTrigger.hide()
        }
        var b = this, a = {source: this.id, process: '@all', update: this.id, global: false, params: [{name: this.id + "_load", value: true}, {name: this.id + "_offset", value: this.cfg.offset}], onsuccess: function(e, c, d) {
                PrimeFaces.ajax.Response.handle(e, c, d, {widget: b, handle: function(f) {
                        this.list.append(f)
                    }});
                return true
            }, oncomplete: function() {
                b.loading = false;
                b.allLoaded = (b.cfg.offset + b.cfg.chunkSize) >= b.cfg.totalSize;
                b.loadStatus.remove();
                if (b.loadTrigger && !b.allLoaded) {
                    b.loadTrigger.show()
                }
            }};
        PrimeFaces.ajax.AjaxRequest(a)
    }
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2013-04-11
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-11-19
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多