cancel
Showing results for 
Search instead for 
Did you mean: 

Filter Button on In Table Toolabr to enable & disable Filter capabilities

Former Member
0 Kudos

Hello,

I have a WD Table where I have implemented the Filter capabilities as explaned in the Tutorial

"Generic Web Dynpro Java Table Filter" and it works fine.

I would like now to add a Filter button in the Table Toolbar where I 'll be able to enable/disable the

the Filter capabilities and to Show/hide the added Filtering Row acording to the button state.

Could you please help on this issue.

Thanks in Advance

Best regards,

Harry

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

The filter button and filter fields are only displayed if the "filterValue" property of the corresponding table columns are bound to some context attribute.

So you could realize this activate/deactivate filter by adding/removing the context binding for these properties.

Armin

Former Member
0 Kudos

Hello Armin,

in the wdDoModifyView method of my View

I have bind dynamicaly the filter values of my table columns as you said see below

if(filterButtonChecked){

IWDTableColumn tableColumnOfFPNsystemName = (IWDTableColumn)view.getElement("producerName");

tableColumnOfFPNsystemName.bindFilterValue ("FpnSystemsMngmt.SLDProducersDataFilter.producerName");

IWDTableColumn tableColumnOfFPNsystemId = (IWDTableColumn)view.getElement("producerID");

tableColumnOfFPNsystemId.bindFilterValue("FpnSystemsMngmt.SLDProducersDataFilter.producerID");

}

else{

IWDTableColumn tableColumnOfFPNsystemName = (IWDTableColumn)view.getElement("producerName");

tableColumnOfFPNsystemName.bindFilterValue("");

IWDTableColumn tableColumnOfFPNsystemId = (IWDTableColumn)view.getElement("producerID");

tableColumnOfFPNsystemId.bindFilterValue("");

}

Unfortunaltly I can still see the Blank fielter field on top of those columns.

Did I miss something.

Thanks & regards

Harry

Former Member
0 Kudos

Do it like this:


IWDTableColumn tableColumnOfFPNsystemName = (IWDTableColumn) view.getElement("producerName");
tableColumnOfFPNsystemName.bindFilterValue(filterButtonChecked ? "FpnSystemsMngmt.SLDProducersDataFilter.producerName" : null);

Armin

Former Member
0 Kudos

Hi Armin,

I did as you advise me to do but it works only for the first time.

I mean that in my code I have designed the behavior to be such that when the table is initialy loaded

the filter is disabled. Until now now problem and the filter columns are not visible.

After first click on my filter button

public void onActionFilterDisplayFilter(){

if(ButtonChecked){

wdContext.currentSLDProducersDataFilterElement().setfilterButtonChecked(true);

}

else{

wdContext.currentSLDProducersDataFilterElement().setfilterButtonChecked(true);

}

}

wdDoModifyView(){

boolean filterButtonChecked = wdContext.currentSLDProducersDataFilterElement().getEnableFilter();

IWDTableColumn tableColumnOfFPNsystemName = (IWDTableColumn)view.getElement("producerName");

tableColumnOfFPNsystemName.bindFilterValue(filterButtonChecked ? "FpnSystemsMngmt.SLDProducersDataFilter.producerName" : null);

IWDTableColumn tableColumnOfFPNsystemId = (IWDTableColumn)view.getElement("producerID");

tableColumnOfFPNsystemId.bindFilterValue(filterButtonChecked ? "FpnSystemsMngmt.SLDProducersDataFilter.producerID" : null);

}

It works only

Former Member
0 Kudos

Hi Armin,

please ignore the previous notification.

I did as you advise me to do but it works only for the first time.

I mean that in my code I have designed the behavior to be such that when the table is initialy loaded

the filter is disabled. Until now now problem and the filter columns are not visible.

After first click on my filter button the Filter columns appears as expected.

But then repeating the operation does not Hide the Filter columns anymore , no matters with Filter button state.

public void onActionFilterDisplayFilter(){

if(ButtonChecked){

wdContext.currentSLDProducersDataFilterElement().setfilterButtonChecked(true);

}

else{

wdContext.currentSLDProducersDataFilterElement().setfilterButtonChecked(false);

}

}

wdDoModifyView(){

boolean filterButtonChecked = wdContext.currentSLDProducersDataFilterElement().filterButtonChecked;

IWDTableColumn tableColumnOfFPNsystemName = (IWDTableColumn)view.getElement("producerName");

tableColumnOfFPNsystemName.bindFilterValue(filterButtonChecked ? "FpnSystemsMngmt.SLDProducersDataFilter.producerName" : null);

IWDTableColumn tableColumnOfFPNsystemId = (IWDTableColumn)view.getElement("producerID");

tableColumnOfFPNsystemId.bindFilterValue(filterButtonChecked ? "FpnSystemsMngmt.SLDProducersDataFilter.producerID" : null);

}

Can you please help.

Thanks again,

harry

Former Member
0 Kudos

Maybe you should not execute the code in wdDoModifyView() every time but only when the corresponding action has been triggered. This can be controlled by an additional flag "FilterDisplayToggled" or something like that. This flag would be set to true everytime the button is clicked.

In wdDoModifyView() you would then have something like


if ( wdContext.currentContextElement().getFilterDisplayToggled() )
{
  wdContext.currentContextElement().setFilterDisplayToggled(false);
  // .. as before
 }

Another possibility (that hides all filter fields) would be to just disable the filter action itself inside the button handler.

Armin

Former Member
0 Kudos

Hi Armin,

Many thanks.

It is now working.

I have rewarded you with 10 points.

Best regards,

Harry

Answers (0)