cancel
Showing results for 
Search instead for 
Did you mean: 

Problem in Basic Table UI Element in Web Dynpro For Java.

Former Member
0 Kudos

Hi,

In a view I have created table which contain some data from Database.

Now my issue is

On clickiing the row in the table move to another page where i need to display these row values in label fields.

Can any body please help me the procedure how to get particular row values in second view.

Thanks and Regards,

Shashikiran.B

Accepted Solutions (0)

Answers (4)

Answers (4)

Former Member
0 Kudos

Hi,

On Action type LeadSelection; you can get the table values and assign to the view context element.


wdContext.currentContextElement().setNameElmt( wdContext.nodeTableRecord().getNameElement());

Create an element of type NameElmt at Controller Context and the second view and map the three using data modeller.

In the second view; bind this NameElmt to the UI element.

This will work.

Regards

- Vinod

*

Former Member
0 Kudos

Hi Shashi,

I believe the node in view1 have been mapped with some node in Component Controller. Now, map the the attributes that you want to display from component controller to view2.

Now create a navigation from view1 to view2. Suppose OutboundPlug in view1 is named as ToView2 and inbound plug in View2 in named as FromView1.

In view1 code create a new action which will be fired OnLeadSelect of the table. In the method associated with this action fire the Outbound plug, ToView2.

Also in view2, create a form using apply template which is bind to attributes of view2's context. (This attributes are mapped to component controller 's attributes as explained earlier).

Regards,

Gopal

Former Member
0 Kudos

Hi,

Thank you for your quick replay .

i have done same thing what you have specified but while selecting the row i am getting the first row values only.

I am unable to get the selected row values.

I need to get the selected row values .

Can any body please help regarding this one.

Thanks in advance.

Regards,

Shashikiran.B

Former Member
0 Kudos

Hi,

Do the context mapping for both the views via controller for the node of your table in the parent view. Use the sane node to map the data fields in the second view. No extra coding is required for this.

thanks & regards,

Manoj

Former Member
0 Kudos

Hi,

For this you need to have mapping of context from parent view to the next detail view via controller.

For navigation purpose you can make use of the navigational plugs.

Fire the plug on the lead select event of the list table of the parent view.

Hope this helps.

thanks & regards,

Manoj

Former Member
0 Kudos

Hi,

Bind the attributes from the same context which is bound to the table to your text boxes .

Once this binding is done when you select the values it will be shown in the respective columns with out any code.

Regards

Ayyapparaj

Former Member
0 Kudos

Hi ,

I have mapped both views to the same node through component controller.

I am able to get the first row values only when i select a row.

but i need to get selected row values in next view.

Thanks and Regards,

Shashikiran.B

former_member751941
Active Contributor
0 Kudos

Hi shashi,

Try this

Take a Button(GoToNext) in the First View to copy the First View table selected Selected Row(s) to the Second View Level.

Assuming

First Field table Structure

EmployeeRec(0..n)

|--Ename

|--Eno

|--Esal

Second Filed Level Node Structure

Employee(0..1)

|---Name

|---No

|---Sal

public void onActionGoToNext(com.sap.tc.webdynpro.progmodel.api.IWDCustomEvent wdEvent )
  {
    //@@begin onActionGoToNext(ServerEvent)
int index = wdContext.node EmployeeRec().getLeadSelection();
wdThis.wdGet<ComponentName>Controller().executeCopy(index);
wdThis.wdFirePlug<Out bound Plug from First view to 2nd view>();
    //@@end
  } 


Take a method (executeCopy) with parameter selIndex of type integer inside component contoller

  public void executeCopy( int selIndex )
  {
    //@@begin executeCopy()
      wdContext.nodeEmployee().bind(wdContext.createEmployeeElement());

wdContext.currentEmployeeElement().setName(wdContext.nodeEmployeeRec().getEmployeeRecElementAt(selIndex).getEname());
wdContext.currentEmployeeElement().setNo (wdContext.nodeEmployeeRec().getEmployeeRecElementAt(selIndex).getEno ());
wdContext.currentEmployeeElement().setSal(wdContext.nodeEmployeeRec().getEmployeeRecElementAt(selIndex).getESal());
    //@@end
  }

Regards,

Mithu

Former Member
0 Kudos

Hi Mithu,

thanks for your quick replay,

I have tried this one but its not matching to my requirements.

My requirement is

I have a table data on selecting a particular row of a table i need to get the field details in next view's text field's.

For that i have mapped same node and attributes for both the views.

By this i am getting only first row values . irrespective to selected row.

But i need to get the selected row values only.

can you please help me out.

Thanks and Regards,

Shashikiran.

Former Member
0 Kudos

Hi Shashi,

Can you please check following:

1. Check property of Component Controller's node which holds data:

InitializeLeadSelection must be true.

selection is 0..1

1. Check Property in view1's table:

rowSelectable is true

selection mode is auto

Regards,

Gopal

Former Member
0 Kudos

Hi Gopal,

The properties are same what you have specified.

But i am not getting selected row values.

Thanks and Regards,

Shashi.

Former Member
0 Kudos

Hi Shashi,

Don't know where you are going wrong. For your purpose I created a new project and it's working for me. Follwoing are the steps I had taken:

Step 1:

a. In Component controller created a node "Node1".

b. Under it i created an attribute "att1".

In wdInit() of controller I wrote code as follows:

		for (int i = 0; i < 3; i++) {
			IPublicComp.INode1Element ele = wdContext.createNode1Element();
			ele.setAtt1("" + i);
			wdContext.nodeNode1().addElement(ele);
		}

Step 2:

Created a navigation from view1 to view2

Outbound plug of view1: ToView2

Inbound Plug of View2: FromView1

Step 3:

mapped Node1 from controller to View1

Step 4:

Mapped attribute att1 from controller to view2's context.

Step 5:

a. In view1, Using apply template created a table for node1.

b. Created an action event for onLeadSelect of table and fired outbound plug as follows:

wdThis.wdFirePlugToView2();

Step6: In view 2

Used apply template, created a form for attribute att1.

After deploying it, when i selected any row of table in view1, i got the respective value in view2.

Regards,

Gopal

nikhil_bose
Active Contributor
0 Kudos

put this code in the action part (probably in OnTableLeadSelect())

wdThis

.wdGet<your_Component>Controller()

.wdGetContext()

.node<you_table_node>()

.setLeadSelection( wdContext

.node<yourTableNode()

.getLeadSelection());

regards,

nikhil

Former Member
0 Kudos

Sorry, but why should he write this monster of statement and not just map the node from the view controller and write


wdContext.current<Node>Element()

to get the lead-selected element?

And if he changes the lead-selection of the view controller node (which is mapped to the component controller), then the lead-selection of the origin node is changed automatically.

Armin

nikhil_bose
Active Contributor
0 Kudos

Former Member
0 Kudos

Hi,

Thank you very much i solved this issue.

Thanks and Regards,

Shashikiran.B