smart gwt comboBoxItem deosn't filter based on

2019-09-19 04:54发布

ComboBoxItem buildings = new ComboBoxItem("buildings", "Building Names") {
        public Criteria getPickListFilterCriteria() {
            Criteria criteria = new Criteria();
            criteria.setAttribute("dependentString", grid.getSelectedRecord().getAttribute("company"));
            criteria.setAttribute("dependentString2", "office");
            return criteria;
        }
    };
    buildings.setOptionDataSource(CommonLookupDS.getLookupDS(LookupTypesClient.LOOKUP_BUILDINGS_BY_TYPE));
    buildings.setValueField("key");
    buildings.setDisplayField("value");
    buildings.setWidth(125);
    buildings.setWrapTitle(true);
    buildings.setAutoFetchData(false);
    buildings.setRequired(true);

Once the getPickListFilterCriteria method is overridden this comboBox stops filtering for user input. It shows all the options regardless of the user input. How to fix this?

2条回答
爷、活的狠高调
2楼-- · 2019-09-19 05:32

This can be done by appending criteria to datasource For an example

buildings.setOptionDataSource(CommonLookupDS.getLookupDS(LookupTypesClient.LOOKUP_BUILDINGS_BY_TYPE
                                +"&dependentString="+grid.getSelectedRecord().getAttribute("company")+"&dependentString2="+office));

and prevent from overriding getPickListFilterCriteria method

查看更多
在下西门庆
3楼-- · 2019-09-19 05:53

I put all my criteria settings to datasource and it works. So, in method transformRequest I do

public Object transformRequest(DSRequest dsRequest){
    dsRequest.setHttpMethod("POST");
    return "<json>";
}
查看更多
登录 后发表回答