on 04-12-2007 6:52 AM
Hi all,
Can anybody tell me how can I display values to a Table? I've already designed the table UI which has 4 columns.I'm trying to get the data from the database and display it in the table row by row.Please help me with the code.
Thanks,
Shiny
Hi all,
Initially i had 2 views. First view is juz a text to get the input. I'm sending this value to the next view which has a table to display a set of values from a resultset queried based on the input value.
Now I need to have only one view. when i click the button, the table with the should be displayed below in the same view. Can anybody give an idea????
Thanks,
Shiny
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Shiny,
You can acheive by Visiblity..
You can create a valueAttribute say tableVisibility (of type com.sap.ide.webdynpro.uielementdefinitions.Visibility) and bind it to the 'visible' property of the table.
Initially, set the tableVisibility to NONE.
wdContext.currentContextElement().setTableVisibility(WDVisibility.NONE);
Onclick button action you set the visibility of the table to "VISIBLE" using the contextelement (=tableVisibility)
wdContext.currentContextElement().setTableVisibility(WDVisibility.VISIBLE);
Regards, Suresh KB
Thanks a lot everybody....It worked...
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Shiny,
First create context mapping from model to Component controller and from component controller to view controller context.
Now go to view layout.
In the outline tab right click on the transparent container and choose apply template.
In the template choose table and click next.
You can see all the nodes and attributes.
Choose the attributes you want to display in the table.
Hope this will solve your problem.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Suresh & Omri,
Thanks a lot.It helped but only one value is getting displayed in the table. But there are lots of data in the resultset. Please help
Thanks,
Shiny
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
try this code...
int n = wdContext.nodeDB().size();
Suppose the node from database is DB has attibutes No and Name. and the value node has two attributeas A and B.
IPrivateViewname.IDBNode dbnode = wdContext.DB();
IPrivateViewName.IValueNode node = wdContext.nodeValue();
IPrivateViewName.IValueElement ele;
for (int k = 0 ; k < n ; k++)
{
ele = node.createValueElement();
ele.setA(dbnode.getDBElementAt(k).getNo());
ele.setB(dbnode.getDBElementAt(k).getName());
wdContext.nodeValue().addElement(ele);
}
Hope this works....
Regards
Prasy
Hi Shiny,
Try printing the sizes of resultset and the table datsource node in your view and see whether the two are same or not.
wdComponentAPI.getMessageManager.reportSuccess("Size of resultset is "resultset.size()" and the size of table data source node is "+wdContext.nodeTableSource().size());
Regards
Sid
Hi,
Define a value node in the context. Call it 'data'
data will have 4 value attributes: field1, field2, field3 & field4
The fields from the DB are called f1, f2, f3 & f4
Now, do something like this:
IPrivate<view name>.IDataNode node = wdContext.nodeData();
IPrivate<view name>.IDataElement elem = null;
while (rs.next) {
elem = node.createDataElement();
elem.setField1(rs.getString("f1"));
elem.setField2(rs.getString("f2"));
elem.setField3(rs.getString("f3"));
elem.setField4(rs.getString("f4"));
node.addElement(elem);
}
Omri
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Shiny,
Try like this
Create Value Node Table under that create A,B,C,D context value attribute bind to table UI element.
Fetch the data from Database and set to the table context attibute
for(int i=0 ; i<nodesize ; i++) {
IPrivateView.ITableElement element = wdContext.createTableElement();
element.setA(A);
element.setB(B);
element.setC(C);
element.setD(D);
wdContext.nodeTable().addElement(element);
}
Regards, Suresh KB
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 | |
10 | |
10 | |
10 | |
7 | |
6 | |
6 | |
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.