Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    How to make the filter in listgrid header as normal ComboBoxItem

    1. smartClient Version: v8.3p_2013-01-15/PowerEdition Deployment (built 2013-01-15)
    2. browser(s) Firefox 21.0

    1. I create a listgrid which contains one Field.
    ListGridField fModel = new ListGridField("model","Model" );

    2. I attached a datasource for this field's filter in the header.
    fModel.setOptionDataSource(dsAttrModel);

    3. The filter is a pickList(?) and shows all possible models from the data source dsAttrModel. Let's say the dsAttrModel has values of: (a11,a22,b11,b22,c11,c22).
    Its current behavior is:
    (1) when I press key "b" in the filter box, there is no "b" show in the filter box;
    (2) the option dropdown list show all values and "b11" is selected.

    4. My question is: how can I make the filter box work as normal ComboBoxItem.
    (1) when I press key "b" in the filter box, the "b" show in the filter box;
    (2) the option dropdown list show only values starts with "b" -- that is "b11" and "b22".
    (3) when I press key "b22" in the filter box, the "b22" show in the filter box;
    (4) the option dropdown list show only values starts with "b22" -- that is "b22" only.

    Is it possible? Can you give me some sample code?
    Thanks!

    #2
    Got the answer.

    Here is the answer. Hope it is helpful for other people.

    public static void linkComboAsHeaderFilter(String cbName, DataSource ds, ListGridField listField){
    final ComboBoxItem cb = new ComboBoxItem(cbName);
    cb.setOptionDataSource(ds);
    cb.setFilterLocally(true);
    cb.setShowAllOptions(false);
    listField.setFilterEditorType(cb);
    }

    Comment

    Working...
    X