cancel
Showing results for 
Search instead for 
Did you mean: 

Table Filter various blogs:

Former Member
0 Kudos

Hello Friends,

I want to implement a table filter ? there are couple of blogs avaiable, so thought before starting one, ask for your comments and experience ?

So which way you recommand to implement the table filter ?

Regards,

Accepted Solutions (0)

Answers (6)

Answers (6)

Former Member
0 Kudos

I am closing this thread, and will open a new in this regards,....

Former Member
0 Kudos

Hi Shah,

just complete this nice tutorial of Peter Vignet. It demonstrates the basic use and concept of his filter class. Pay attention to the notes at the end of the blog.

<a href="/people/peter.vignet/blog/2007/01/03/generic-web-dynpro-java-table-filter:///people/peter.vignet/blog/2007/01/03/generic-web-dynpro-java-table-filter.

Kind Regards,

Martin

Former Member
0 Kudos

Okay will give a try to this blog now, ......

Regards,

Former Member
0 Kudos

in this blog I am also getting exception:

The initial exception that caused the request to fail, was:

java.lang.NullPointerException

at com.sonopress.util.TableFilter.setFiltersForColumns(TableFilter.java:100)

at com.sonopress.util.TableFilter.init(TableFilter.java:66)

at com.sonopress.util.TableFilter.<init>(TableFilter.java:46)

at com.sonopress.portalpo.PopupView.wdDoModifyView(PopupView.java:152)

at com.sonopress.portalpo.wdp.InternalPopupView.wdDoModifyView(InternalPopupView.java:551)

My wdModify looks like:

IWDTable table = (IWDTable) view.getElement("Table_1");

wdContext.currentContextElement().setTableFilter( new TableFilter(table, wdThis.wdGetFilterAction(), wdContext.nodeZTest(), null));

where as nodeZTest is a model node in context root.

and my onactionfilter looks like as:

wdContext.currentContextElement().getTableFilter().filter(wdContext.nodeZTest(), wdContext.nodeCopy_Zmat_Fg());

Where as nodeCopy_Zmat_Fg() contains the same fields as nodeZTest();

what I here did not understand is, how I can send the filtervalue to the class TableFilter?

No idea... what is going on with table filter...

Regards,

Former Member
0 Kudos

Hi,

hm... I don´t know exactly whether there is a difference between model nodes and value nodes in accessing the context from source code. You wrote, that filtering the table data already works. So, if you are filtering the table data the filtered data replaces your original table data, I guess. And that´s why you need to bind a seperate node to the table, which keeps the filtered data only. On init(), copy the entire original data from your xyz node to the filtered node via WDCopyService.. as I mentioned.. Think of Queries and ResultSets (&Cursors) of Database concepts...

If the architecture of your current project doesn´t match the needs of the filter class.. then you probably have to choose another way...

Former Member
0 Kudos

hello Martin,

How I could do this, I mean my table is currently bound to node which I got form RFC model.... how I can bound a single table with two nodes?

thanks and kind regards,

, I guess. And that´s why you need to bind a seperate node to the table, which keeps the filtered data only. On

Former Member
0 Kudos

Hello Martin,

Okay I will try to explain what I have now and how I did, may be you have a clue for me

my flitering is not working ( but it worked before, )

So in my view I have a modle node:

nodeRFC_ShippingPartner_In().nodeOutput().nodeZmat_Fg() ( this is my node which I got from RFC modle via controller and this node I have bound to my table and its column. the table shows the correct data ( rows ).

Now I have created a valuenode Copy_Zmat_Fg() ( it contains the attributs as I have in nodeZmat_Fg().

I have a node called vnFilter which contains two attributes which are my two columns of table....

and onfilteraction i wrote this code:

wdContext.currentContextElement().getTableFilter().filter(wdEvent,wdContext.nodeCopy_Zmat_Fg(),

wdContext.nodeRFC_ShippingPartner_In().nodeOutput().nodeZmat_Fg() , wdContext.nodeVnFilter());

but filtering did not worked for me.....

Any suggestion ?

Former Member
0 Kudos

Hi,

your table dataSource property should be bound to the context node keeping the filtered data only..

Regrads,

Martin

Former Member
0 Kudos

Hello Martin,

Thanks for your resposne

my table is bound to the datasourceoriginal node which is a modle node ( mapped via controller to the RFC model )... and that's why all data is shown first in the table....

Sorry I did not understand your reply, can you pls be more descriptive ?

Danke und LG

Former Member
0 Kudos

Hi Shah H,

since your table maybe displays/works on the filtered set only, I think. You could try to add a toolbar button to the table UI element and label it something like 'ShowAll' and assign an action method to it. Make use of the nodeCopyService() and copy your entire source set data to the appropriate node which is bound to your table... in that case, the filtered set...

In the method type something like this...


//@@begin
WDCopyService.copyElements( wdContext.node<+yourSourceSetNode+>(),  wdContext.node<+yourFilteredSetNode+>() );
//@@end

Former Member
0 Kudos

Hi Martin,

Thanks for your reply, I will try this, and let you know, if it works for me

Till then,

Regards,

Former Member
0 Kudos

Hello,

Dont know things are not working fine to me, ( I have not made changes ) but now when I try to filter, the filter resutl is not comming rather all data is shown ...... even though I have not changed much.

I have a question, : we use two node, one is dataoriginalsource and one is datasource ( both node have to be mapped or only dataoriginalsource have to be mapped ) ?

Regards,

former_member197348
Active Contributor
0 Kudos

Hi Shah,

Use this https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/60d5b593-ba83-2910-28a9-a7a7c7f5...

Very useful document. This for reference, this is not a blog.

regards,

Siva

Former Member
0 Kudos

Thanks, but I am trying first this blog:/people/kapil.kamble/blog/2006/12/21/how-to-get-ready-made-filter-for-your-web-dynpro-table-with-minimal-coding

and in this regard, I have a question: why he is copying the data source and sending in on action ?

Like I have a table with columns form context node ( its model node ), so I want to know why I need to copy it as he did e-g. nodeVnTableDataSource and nodeVnOriginalDataSource ?

Regards,

Former Member
0 Kudos

This blog did not work-out for me (/people/kapil.kamble/blog/2006/12/21/how-to-get-ready-made-filter-for-your-web-dynpro-table-with-minimal-coding)

When I enter the value, the table values just disappered, but no result?

Can anyone pls help me or have any idea for me ?

Regards,

former_member197348
Active Contributor
0 Kudos

Hi Shah,

The Tablefilter is little confusing initially. Please remember, in the for tableFilter we need to maintain two nodes. One is for original data, another is for the data matched for filter criteria. When you search using filter if no record matches your search criteria, you will get empty table. If you are getting empty result eventif you give same values as in the table, that means there is a problem in onFilter action or data(may be padding in the String values etc..) . If you click again on the filter then you will get original data.

regards,

Siva

Former Member
0 Kudos

Hi Siva,

I am facing following exception:

<b>com.sap.tc.webdynpro.progmodel.context.ContextException: Node(PopupView.RFC_ShippingPartner_In_1.Output_1.Zmat_Fg_2): cannot bind or add elements because the node has no valid parent

</b>

where as RFC_ShippingPartner_In_1.Output_1.Zmat_Fg_2 is the node str which I copy ....

Do you have any suggestion for me ?

Reards,

Message was edited by:

Shah H

former_member197348
Active Contributor
0 Kudos

Hi Shah,

It is hard to find this type of problem without seeing that. Anyway let's try. Check all your nodes whether they have valid bindings and mappings. For your table filter the two nodes should be identical. In onfilter action check whether you are doing comarisons and copying to proper nodes and attributes etc.

regards,

Siva

Former Member
0 Kudos

oh I have forgotten to bind ( I just copied the node and paste at context ), okey, I bind this with controller and see ...

thx

Former Member
0 Kudos

Okey atleast it works so far that, it bring me the result, but when I click on the filter again, or remove the filter value, it does not show me all records again ??

Regards,

former_member197348
Active Contributor
0 Kudos

Hi Shah,

It's nice then. Please paste your onfilter action atleast last half because there is problem in this. If you want to check yourself check at the end of action you need to <b>copy back all the values to the tablenode if it is failing all matching conditions</b>.

Hope this is my last post and solves your problem

regards,

Siva

Former Member
0 Kudos

Hi Siva,

I have just pasted as described in the blog: so my onActionFilter looks like as_

public void onActionFilter(com.sap.tc.webdynpro.progmodel.api.IWDCustomEvent wdEvent )

{

//@@begin onActionFilter(ServerEvent)

wdContext.currentContextElement().getTableFilter().filter(wdEvent,wdContext.nodeRFC_ShippingPartner_In_1().nodeOutput_1().nodeZmat_Fg_1(),

wdContext.nodeRFC_ShippingPartner_In().nodeOutput().nodeZmat_Fg() , wdContext.nodeVnFilter());

//@@end

}

How I can check, if filter is fail or user has click on filet icon again ( so that I can show the complete table data again ) ?

Regards,

Message was edited by:

Shah H

former_member197348
Active Contributor
0 Kudos

Hi Shah,

wdContext.currentContextElement().getTableFilter().filter(wdEvent,wdContext.nodeRFC_ShippingPartner_In_1().nodeOutput_1().nodeZmat_Fg_1(),

wdContext.nodeRFC_ShippingPartner_In().nodeOutput().nodeZmat_Fg() , wdContext.nodeVnFilter()); 

Did you create a model node. Create value node with same attributes' names and pass it,

wdContext.currentContextElement().getTableFilter().filter(wdEvent,valuenode,
wdContext.nodeRFC_ShippingPartner_In().nodeOutput().nodeZmat_Fg() , wdContext.nodeVnFilter()); 

This will solve your problem

All the best.

Siva

Former Member
0 Kudos

Hello Siva,

humm... the problem is if I create now the valuenode then how I will bind ? as in my controller I have the modle node, ?

Regareds,

former_member197348
Active Contributor
0 Kudos

Hi Shah,

In the table filter we should use two nodes. One is the <b>OriginalSource </b>node, Two is <b>Copy </b>of the node. Try this

1.Create a Value node say Copy_Zmat_Fg

2.Create attributes in the value node with exactly same names as in the model node Zmat_Fg

3._No need of mapping_ this Value node.

WDCopyService.copyElements(Zmat_Fg,Copy_Zmat_Fg);

Bind this value node to Table.

4.

wdContext.currentContextElement().getTableFilter().filter(wdEvent,wdContext.nodeCopy_Zmat_Fg(),
wdContext.nodeZmat_Fg() , wdContext.nodeVnFilter()); 

Hope it will solve your problem.

regards,

Siva

Edited by: Siva Rama Krushna on Dec 18, 2007 4:41 PM

Former Member
0 Kudos

humm.... for this I need to change the context in controller as well ( as I have also modle node there and this model node I then made in view, so I have to change this in view and in controller as well, .....

Okay, will give it a try, ..... ( my only problem is that when user click on filter button again with filter entry equal to space, then I want all data should come back )...

Regards,

Former Member
0 Kudos

hello Siva,

I am still facing the same issue, I have mapped the model node with model node in my controller context and in view context I also have model node. And you suggested instead of model node create the value node, ( I tried with value node, but I am facing issue with binding )....

Any suggestino for me ?

Regards,

Former Member
0 Kudos

Hello,

Anyone has any suggestion / idea for me, how to fix the issue :-)....

I can search the filter value, but when I remove the "filter value" and click again of filter icon, the table remains empty.....

Regards,

Former Member
0 Kudos

Hello Siva,

I have now started things form start, and as described in your this post, I have created a new copyZmat_fg and I have few confusions:

where I have to do WDCopyService.copyElements(Zmat_Fg,Copy_Zmat_Fg);?

I guess the code for me will be as

WDCopyService.copyElements(wdContext.nodeRFC_ShippingPartner_In().nodeOutput().nodeZmat_Fg(),wdContext.nodeCopy_Zmat_Fg());

Right ?

Secondly you mentioned, bind this value node to table ? if I bind this valuenode then I did not see anything in my table ?

Pls suggest ...

Regards,

-


Hi Shah,

In the table filter we should use two nodes. One is the OriginalSource node, Two is Copy of the node. Try this

1.Create a Value node say Copy_Zmat_Fg

2.Create attributes in the value node with exactly same names as in the model node Zmat_Fg

3.No need of mapping this Value node.

WDCopyService.copyElements(Zmat_Fg,Copy_Zmat_Fg);

Bind this value node to Table.

4.

wdContext.currentContextElement().getTableFilter().filter(wdEvent,wdContext.nodeCopy_Zmat_Fg(),

wdContext.nodeZmat_Fg() , wdContext.nodeVnFilter());

Hope it will solve your problem.

regards,

Siva

Edited by: Siva Rama Krushna on Dec 18, 2007 4:41 PM

Former Member
0 Kudos

Hello Siva,

As per your post, I have did following in wdModifyView method :

WDCopyService.copyElements(wdContext.nodeRFC_ShippingPartner_In().nodeOutput().nodeZmat_Fg(),wdContext.nodeCopy_Zmat_Fg());

I have bond the value node to table wdContext.nodeCopy_Zmat_Fg(),

and onfilteraction i did following:

wdContext.currentContextElement().getTableFilter().filter(wdEvent,wdContext.nodeCopy_Zmat_Fg(),

wdContext.nodeZmat_Fg() , wdContext.nodeVnFilter());

But it is not filtering for me, What I am doing wrong ?

Regards,

Edited by: Shah H on Dec 18, 2007 2:12 PM