Primefaces 5.0 datascroller和分页

时间:2014-06-11 16:36:15

标签: java jsf-2 primefaces

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

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

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

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

由于

1 个答案:

答案 0 :(得分:0)

我终于以快速而肮脏的方式做到了。 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)
}