on 01-21-2009 9:16 AM
Hi,
I have to table. Both table content will fill from SQL. My Question is How can i fill the second table content from the which value i select from first table. I have written code like this.
But when i click first element it will display the content in second table when i click next row it should change the content according to that. How can i do that.
Here is my code.
wdContext.currentContextElement().setVisiblity(WDVisibility.VISIBLE);
int n = wdContext.nodeFirstTable().size();
int leadSelected = wdContext.nodeFirstTable().getLeadSelection();
for (int i=0;i<n;i++)
{
if(leadSelected==i)
{
IFirstTableElement ele=wdContext.nodeFirstTable().getFirstTableElementAt(i);
Date datesec=ele.getMyDate();
java.sql.Date datesec1=new java.sql.Date(datesec.getTime());
wdComponentAPI.getMessageManager().reportSuccess(
"lead selection " + i +"laed "+leadSelected);
try{
CallableStatement cStmt = con.prepareCall("{CALL Usp_TimeSheet_IUSDL1(?,?)}");
wdComponentAPI.getMessageManager().reportSuccess(
"lead selection " + datesec1.toString());
cStmt.setInt(1,id);
cStmt.setDate(2,datesec1);
cStmt.execute();
ResultSet rsDetail=cStmt.getResultSet();
IPrivateEntryView.ISecTableElement sel=wdContext.nodeSecTable().createSecTableElement();
while(rsDetail.next())
{
wdComponentAPI.getMessageManager().reportSuccess("rsDetail first");
String coun=rsDetail.getString(3);
wdComponentAPI.getMessageManager().reportSuccess("Date "+coun);
sel.setCountry(coun);
String rdr=rsDetail.getString(5);
wdComponentAPI.getMessageManager().reportSuccess("RDR "+rdr);
sel.setBRR(rdr);
String act=rsDetail.getString(6);
wdComponentAPI.getMessageManager().reportSuccess("Act "+act);
sel.setActivity(act);
float hrs=rsDetail.getFloat(8);
sel.setHrsWorked(hrs);
String com=rsDetail.getString(10);
sel.setComments(com);
String sta=rsDetail.getString(15);
sel.setStatus(sta);
String appcom=rsDetail.getString(18);
sel.setAppComments(appcom);
wdContext.nodeSecTable().addElement(sel);
}
rsDetail.close();
}
catch(Exception e)
{
wdComponentAPI.getMessageManager().reportSuccess(e.toString());
}
}
}
Regards,
H.V.Swathi
Hi Swathi,
For your requirement you can create two table say TableA and TableB.In Which the TableB vivibility is set to blank or none.
So first the data gets popolated in TableA. Now on click of row from TableA create a action and pass the value you want to pass and populate the TableB with the required data and make the vivibility of TableB to visible.
Again say on click of Row 2 of TableA you need to show the diffrent data in TableB so for that every time you need to invalidate the node first in that method.
e.g Vn_TableB_Node.inValidate();
Hope this will help.
please revert if you need more info.
Regards
Narendra
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
HI Swathi,
Where are you using the above line of code?
This code clears the data contained in the node, i.e., if you use this code after fetching the data into second table it will delete the line of data.
So it should be used such that after raising the event first use this code then fetch the data into second table.
Then only it will work.
Regards.
Rajat
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
1) Associate an event with the Onselect property of the table.
2) Raise the event.
3) In the implementation of that action:
Invalidate the node binded with the second table.
Now you can fetch the data corresponding to the row clicked in the second table.
Regards.
Rajat
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Swathi,
You need to add you code at the onLeadSelect action hadler defined for the first table.
In this way, whenever a row is selected this code will get executed, refreshing the contents dispalyed in the second table.
Also, I would advise you the invalidate the node of the second table at the start of this action handler.
Regards,
Alka.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
91 | |
10 | |
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.