Primefaces LazyDataModel和过滤器

时间:2015-04-08 12:35:01

标签: jsf primefaces datatable

抱歉我的英文。我有TireDTO课程:

public class TireDTO {
    public int fromPrice;
    public int toPrice;

    //get and set
}

表格:

<h:inputText id="fromPrice" value="#{tireMB.tireDTO.fromPrice}"/>
<h:inputText id="toPrice" value="#{tireMB.tireDTO.toPrice}"/>

我想使用带有primefaces dataTable和LazyDataModel的表单进行分页。

我可以发送TireDTO代替Map<String, Object> filters吗?

更新

我试过TireMB

@PostConstruct
    public void init(){
        // +getter , setter
        lazyModel = new LazyDataModel<Site>(){

            private static final long serialVersionUID = 1L;

            @Override
            public List<Site> load(int first, int pageSize, String sortField,
                                         SortOrder sortOrder, Map<String, Object> filters) {

                return getDao().getResultList(getTireDTO(), first, pageSize);
            }
        };

        lazyModel.setRowCount(20);
    }

也许有更好的解决方案。

0 个答案:

没有答案