FilterEditor dependencies

General questions regarding the development with ProjX.

FilterEditor dependencies

Postby jvxdev » Fri Feb 03, 2017 12:53 pm

I have a screen with a table and different filter editors. It works great with minimum configuration. The filter editors are independent and don't depend on each other, right now.

A new requirement is that one filter editor should show the value list in dependence of another filter editor. How to achieve this?

I tried to set an additional condition on the linked cell editor of the databook (which was used as datarow). But this didn't work because the FilterEditor has its own internal datarow?

If I use a simple UIEditor with a custom search row, it's possible with additional condition, but not with FilterEditor?
jvxdev
 
Posts: 19
Joined: Fri Mar 04, 2016 12:40 pm

Re: FilterEditor dependencies

Postby Support@SIB » Fri Feb 03, 2017 1:07 pm

You're right. There's a difference between manual filtering with UIEditor and custom search DataRow and FilterEditor component.

The FilterEditor component has its internal data row. You have access to this data row:

Code: Select all
editor.getUIResource().getDataRow();

but be careful because the data row only is set after the filter editor got an external data row and a column name.

Anyway. It's easy to solve your requirement, with following code:

Code: Select all
filterMaster.eventFilterValueChanged().addListener(this, "doMasterFilterChanged");

...
public void doMasterFilterChanged() throws ModelException
{
    filterDetail.setValue(null);
       
    DataRow rowDetail = filterDetail.getUIResource().getDataRow();

    ((ILinkedCellEditor)rowDetail.getRowDefinition().
            getColumnDefinition(FilterEditor.SEARCH).
            getDataType().getCellEditor()).
            setAdditionalCondition(new Equals("FILTER_COLUMN", filterMaster.getValue()));
}

We reset the value of the detail filter editor and set an additional filter condition for the list of values. The event is necessary for notification about changes in master filter editor.

If you do manual filtering with an UIEditor and a custom search data row, it's not necessary to use value change listeners because the Condition handles everything automatically. The FilterEditor is a custom component and offers standard search functionality and is customizable.
User avatar
Support@SIB
 
Posts: 201
Joined: Mon Sep 28, 2009 1:56 pm


Return to Development