smart gwt comboBoxItem deosn't filter based on user input

余生长醉 提交于 2019-12-25 06:50:57

问题


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?


回答1:


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>";
}



回答2:


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



来源:https://stackoverflow.com/questions/37406929/smart-gwt-comboboxitem-deosnt-filter-based-on-user-input

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!