on 09-20-2006 5:08 AM
Hi
I have a table "MyTable" with "name" as single column in SQL DB. Let the data "abc","def","ghi" ( 3 rows ).
I have created a View "DisplayView" which has a Table element which needs to get the data from the above table "MyTable" and display.
I have created a context element "NAME" ( in component controller) and linked with the "DisplayView".
Please let me know the code to set the values in context and display in the view at runtime.
Regards,
Cris
Hi,
Create one value nodes in component controller and add one value attribute for that node. that is,
in Context
-node1<name>
--attribute1<name>
map this node to DisplayView from component controller.
bind the node1 to 'datasource' property of the table which is in Displayview. and also bind the attribute1 to 'text' property of the tableCellEditor of the corresponding table.
in 'DoInit()' part of the DisplayView,
write
/* here, do the necessary steps to fetch the data from SQL
InitialContext ic=new InitialContext();
try
{
DataSource ds=(DataSource)ic.lookup("<aliasName of DSN>");
Connection con=ds.getConnection();
Statement st=con.createStatement();
ResultSet rs=st.executeQuery( <select query> );
IPrivate<viewname>.I<node1>node n=wdContext.node<node1>;
while(rs.next())
{
IPrivate<viewname>.I<node1>Element e=wdcontext.create<node1>Element();
e.set<attribute1>(rs.getString(<columnname>));
n.addElement(e);
}
}
catch(Exception e)
{
e.printStackTrace();
}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
In the onLeadSelect action of "MyTable", you use code:
wdThis.wdGet[ContronleName]Controller().wdGetContext().currentContextElement().setNAME(value);
may be it will work.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
95 | |
11 | |
10 | |
9 | |
9 | |
7 | |
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.