cancel
Showing results for 
Search instead for 
Did you mean: 

Dynamic OnFilter event assigment in WD UI Table ?

Former Member
0 Kudos

Hi Experts,

i have implemented the TableFilter using the blog see the link

[https://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/60d5b593-ba83-2910-28a9-a7a7c7f5996f]

i wish to ADD a Button ( Show Filter ) such that when application starts table DOES NOT show the filter ROW by default. Ony if user wishes to make a search he should click on Show Filter Button and then filter row should start to appear.

Its kind of dynamic event assignment and de-assignment required on click of button

Any guidance helpfull.

Greetings

Prashant

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

Parveh Help and some common sense

pravesh_verma
Active Contributor
0 Kudos

Hi Prashant,

For achieving this you need to do some run time checks and some dynamic coding.

Please try this:

1) Create a attribute in context node of datatype String and in wdDoModify() write this code in firstTime check:



if(firstTime){
IWDToolBarButton ttb = (IWDToolBarButton)view.getElement("ID_Of_Button");
		ttb.setText("Show Filter");
}

2) On the onToggle event of the button write this code:


IWDTableColumn col1 = (IWDTableColumn)view.getElement("Name_Of_Column1");
		IWDTableColumn col2= (IWDTableColumn)view.getElement("Name_Of_Column2");
		IWDTableColumn col3 = (IWDTableColumn)view.getElement("Name_Of_Column3");
		
		IWDToolBarButton ttb = (IWDToolBarButton)view.getElement("ID_Of_Button");
		
		String value = ttb.getText();
		if(value.equalsIgnoreCase("Show Filter"))
		{
			ttb.setText("Hide Filter");
			ttb.setTooltip("Hide Filter");
			col1.bindFilterValue(wdContext.node<Filter_Node>().getNodeInfo().getAttribute("Attribute_for_Filter_For_Column1"));
			col2.bindFilterValue(wdContext.node<Filter_Node>().getNodeInfo().getAttribute("Attribute_for_Filter_For_Column2"));
			col3.bindFilterValue(wdContext.node<Filter_Node>().getNodeInfo().getAttribute("Attribute_for_Filter_For_Column3"));
		} 
		else
		{
			ttb.setText("Show Filter");
			ttb.setTooltip("Show Filter");
			col1.bindFilterValue(wdContext.node<Filter_Node>().getNodeInfo().getAttribute(""));
			col2.bindFilterValue(wdContext.node<Filter_Node>().getNodeInfo().getAttribute(""));
			col3.bindFilterValue(wdContext.node<Filter_Node>().getNodeInfo().getAttribute(""));
		}

I hope this helps!! Please revert abck in case you want any further help!

Thanks and Regards,

Pravesh

Former Member
0 Kudos

Hi Thanks All,

Just solved the issue.

public void onActionToggleFilter(com.sap.tc.webdynpro.progmodel.api.IWDCustomEvent wdEvent )
  {
    //@@begin onActionToggleFilter(ServerEvent)

	IWDView view = wdContext.currentContextElement().getView();
	IWDTableColumn col1 = (IWDTableColumn)view.getElement("NAME_0");
	IWDAttributeInfo attrInfo  = wdContext.nodeFilterNode().getNodeInfo().getAttribute("");
	col1.bindFilterValue( attrInfo);
		   
    //@@end
  }

only glitch was how to access the VIEW outside the wddomodfy method so had to by pass this by creating the context attribute 'View' of type com.sap.tc.webdynpro.progmodel.api.IWDView assigning this in WDDOMODIFY and using that in my event handler.

Greetings

Prashant

Edited by: Prashant on Apr 17, 2009 4:49 PM

Former Member
0 Kudos

Accessing the view from methods other than wdDoModifyView() is not supported by the programming model (it may work but is not guaranteed to). Better set a flag (boolean context attribute) in the event handler and check/reset this flag in wdDoModifyView().

Armin