Skip to Content
0
Former Member
May 03, 2008 at 04:33 AM

Search in a table

15 Views

Hi!!!

I am working on JAVA NWDS. I have a table which has components like Employee number, name, travel date, from place and to place. I want to add a search functionality, so that the user may enter say employee number and the table will display all the entries corresponding to that number.

An employee can have more than one entries and in this case, the resultant table will display all his entries.

The project already has the functionality of sorting the table, I have used the following code for filtering the table:

public static void wdDoModifyView(IPrivateTravelCompanyPaidView wdThis, IPrivateTravelCompanyPaidView.IContextNode wdContext, com.sap.tc.webdynpro.progmodel.api.IWDView view, boolean firstTime)

{

//@@begin wdDoModifyView

if ( firstTime )

{

if ( null != view )

{

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

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

}

}

if (firstTime)

{

IWDTable table1 = (IWDTable) view.getElement("Table_0_1_2_3");

IWDTable table2 = (IWDTable) view.getElement("Table_0_1_2_3_4");

IWDTable table3 = (IWDTable) view.getElement("Table_0_1_2_3_4_5");

wdContext.currentContextElement().setTableSort_1(new TableSorter(table1, wdThis.wdGetSortAction(), null));

wdContext.currentContextElement().setTableSort_2(new TableSorter(table2, wdThis.wdGetSortAction(), null));

wdContext.currentContextElement().setTableSort_3(new TableSorter(table3, wdThis.wdGetSortAction(), null));

}

}

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

{

//@@begin onActionFilter(ServerEvent)

wdContext.currentContextElement().getTableFilter().filter(wdEvent,wdContext.nodeVnTableDataSource(),wdContext.nodeRequestapproved(),wdContext.nodeVnFilters(),null);

//@@end

}

The above code is displaying the filter but the filtering action is not working. Plz do help.

Can you please help me, how to do this.

Regards Umang