on 06-09-2006 4:14 PM
Hi
I used the blog: /people/subramanian.venkateswaran2/blog/2005/05/10/filtering-table-values-using-webdynpro
I have basic knowledge of java, but my code is refused.I want to build a filter in the resultview On the collum Name. I use a Process_StatusController and the data from the table is comming from a bapi and from the context tree
Y_Tf_Process_Status_Input output Ytf_Process_Log
Can somebody get me started. Because i don't really understand the notes of the java script (stupid me)
Many Thanks
One of the easy and simple ways of filtering would be
to create an additional node identical to the one which
has all the data from the backend and Bind the table to
this additional node.
I assume you have a node in your View's context that is
mapped to the controller's node which has the data from
the Backend.
If currently your view context is this:
BackendDataNode
|-Name
|-Company
|-Id
NameFilterValue(attribute to be bound to Filter value
for Name column in the Table UI)
Create another node as follows:
TableDataNode
|-Name
|-Company
|-Id
Your context must now look like this:
BackendDataNode
|-Name
|-Company
|-Id
TableDataNode
|-Name
|-Company
|-Id
NameFilterValue(attribute to be bound to Filter value
for Name column in the Table UI)
Bind this TableDataNode to the table as the data source
Create a method called populateTable() and copy the
elements from your BackendDataNode to your
TableDataNode.
Use the following code:
wdContext.nodeTableDataNode.invalidate();
for(int i=0; i<wdContext.nodeBackendDataNode.size(); i++)
{
IPrivate<ViewName>.ITableDataNodeElement e =
wdContext.createTableDataNodElement();
e.setName(wdContext.nodeBackendDataNode().getBackendDat
aNodeAt(i).getName());
e.setName(wdContext.nodeBackendDataNode().getBackendDat
aNodeAt(i).getCompany());
e.setName(wdContext.nodeBackendDataNode().getBackendDat
aNodeAt(i).getId());
wdContext.nodeTableDataNode.addElement(i,e);
}
In your wdDoInit, call the populateTable() method:
wdThis.populateTable();
Lets say you have defined the action for filter as
onActionFilterByName(), in the implementation, give the
following:
//Get the filter value from the Name Column
String filterName = wdContext.currentContextElement().getNameFilterValue();
if(filterName == null)
filterName =".*";
//Invalidate all the Elements in the table:
wdContext.nodeTableDataNode.invalidate();
//Iterate thru the backendDataNode to check if the name
filter value matches
for(int i=0; i<wdContext.nodeBackendDataNode.size();i++)
{
String Name =
wdContext.nodeBackendDataNode().getElementAt(i).getAttr
ibuteValue("Name");
if(Name.matches(filterName))
{
IPrivate<ViewName>.ITableDataNodeElement matchElement = wdContext.createTableDataNodElement();
matchElement.setName(wdContext.nodeBackendDataNode().ge
tBackendDataNodeAt(i).getName());
matchElement.setName(wdContext.nodeBackendDataNode().ge
tBackendDataNodeAt(i).getCompany());
matchElement.setName(wdContext.nodeBackendDataNode().ge
tBackendDataNodeAt(i).getId());
wdContext.nodeTableDataNode.addElement(matchElement);
}
if(filterName =="")
wdThis.populateTable();
}
regards,
oj
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
87 | |
23 | |
11 | |
9 | |
8 | |
5 | |
5 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.