本文介绍了智能gwt comboBoxItem基于用户输入的deosn't过滤器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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);

一旦getPickListFilterCriteria方法被覆盖,这个comboBox将停止用户输入的过滤。它显示所有选项,而不管用户输入。
如何解决这个问题?

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?

推荐答案

这可以通过在数据源
上附加条件来完成。

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));

并防止重写getPickListFilterCriteria方法

and prevent from overriding getPickListFilterCriteria method

这篇关于智能gwt comboBoxItem基于用户输入的deosn't过滤器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-21 01:45