on 12-30-2008 9:18 AM
Hi,
My requirement is as follows
1>Displaying results is a table. Presently table has three rows:
ID:Firstname:LastName
2>Selecting a row
3>Retrieving those selected row (lead selection) and setting them into seperate UI Elements(For ex: Input textfield)
Please let me know code samples for the 2) and 3)rd requirements.
Code samples will be rewarded
Thanks
Praveen
Hi,
to get the selected row values do like this in the onSelect event of the table UI,
example "<value node name >" is the dataSource of the table UI.
Private<name>View.I<value node name >Node node = wdContext.node<value node name >();
Private<name>View.I<value node name>Element ele = node.get<value node>ElementAt(node.getLeadSelection());
so by using the "ele" you can get the values of the selected row.
ele.getID()
ele.getFirstname() etc.
then set these values into the seperate UI Elements like this
wdContext.currentContextElement().setSelectedID(ele.getID());
wdContext.currentContextElement().setFirstName(ele.getFirstname() );
so here assume the input fields are bind with the attributes ID and FirstName defined under the root context.
Regards,
ramesh
Edited by: Ramesh Babu V on Dec 30, 2008 3:14 PM
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
hi ,
following steps to be followed...
craete a element of table....the code is shown in some replies..
ipublictableelement ele= new publictableelement();
using this element get the value of the field and stored in local variable...
String text= ele.get(firstname);
and then if u have to set this to a some other ui element then crate a local context ..two attributes firstname and second name and map this to that ui element...
once done just set the values like
wdcontext.currentcontextelement.Va_firstname(text);
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Praveen,
The answer for your question is so simple.
I hope you had created the table with three entries(id,firstname & lastname).
I think you should have finished binding the table & UI elements in "context" tab.
Step 1: Go to the table properties.In "onLeadselect" field create new action by providing "action name " & "action text".
Step 2: Go to the coding part of the newly created action (Leadselect) in implementation tab & provide the below coding.
public void onActionLeadselect(com.sap.tc.webdynpro.progmodel.api.IWDCustomEvent wdEvent )
{
//@@begin onActionLeadselect(ServerEvent)
// Getting selected id,firstname & lastname from table & storing it in corresponding string value
String id1 = wdContext.currentTablenodeElement().getId();
String firstname1 = wdContext.currentTablenodeElement().getFirstname();
String lastname1 = wdContext.currentTablenodeElement().getLastname();
// The above values(id1,firstname1,lastname1) are displayed in the UI elements by using the below
wdContext.currentContextElement().setIdd(id1);
wdContext.currentContextElement().setFname(firstname1);
wdContext.currentContextElement().setLname(lastname1);
//@@end
}
Note:
1) In the context tab i had created the valuenode as "tablenode" .I had created the id,firstname & lastname as value attribute under "tablenode".
2) Create a value attributes "Idd","Fname" & "Lname" in the context tab for three UI elements.
If you have any doubts regarding the above steps, post a message to me.
Regards,
Krishna Balaji T
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Say your context has the following structure:
Rows (node, c=0:n)
-- id (string)
-- lastName (string)
-- firstName (string)
If you just bind e.g. an InputField outside of the table to attribute "Rows/@firstName", then this InputField will automatically edit the lead-selected element of node "Rows". That means to implement your use-case, you just have to assign an empty action to the "onLeadSelect" event of the table (which ensures that a server-roundtrip occurs when the lead-selection changes).
Armin
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
93 | |
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.