cancel
Showing results for 
Search instead for 
Did you mean: 

How to filter a table?

Former Member
0 Kudos

Hi ALL,

I have a table with four columns. One out of them is a unique column. I want to filter the table for 1000 of records w.r.t. the unique column.

Code snippets will be appreciated.

Regards

DK

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Dipendra,

See this blog: <a href="/people/subramanian.venkateswaran2/blog/2005/05/10/filtering-table-values-using-webdynpro Table Values using WebDynpro</a>

Regards,

SK.

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi:

try:

/people/peter.vignet/blog/2007/01/03/generic-web-dynpro-java-table-filter

regards

Former Member
0 Kudos

Hi,

create one context value attribute with String datatype for ex. Filter_Value. And bind this attribute to the filterValue property of the table column.

write the following code in OnFilter event of the table.

String filterName = wdContext.currentContextElement().getFilter_Value();

if(filterName!=null && !filterName.equals(""))

{

// Here, call the method (or) write the code which is used to load the table.

IPrivate<View>.I<Table_Node> myNode = wdContext.node<Table_Node>();

int n = myNode.size();

HashMap filterMap=new HashMap();

int val=0;

for (int i = n - 1; i >= 0; i--)

{

String value = (String) myNode.get<Table_Node>ElementAt(i).get<Attribute_Name>();

if (value.toLowerCase().startsWith(filterName.toLowerCase()))

{

IPrivate<View>.I<Table_Node>Element myElement = myNode.get<Table_Node>ElementAt(i);

filterMap.put("Elem" + val,newElement);

val++;

}

}

myNode.invalidate();

for(int j=0;j<val;j++)

{

myNode.addElement((IPrivate<View>.I<Table_Node>Element)filterMap.get("Elem" +j));

}

}

regards

karthik