cancel
Showing results for 
Search instead for 
Did you mean: 

Table Actions

Former Member
0 Kudos

Hi all,

I have a table on my webdynpro screen with three columns and two rows of data.

Out of the one column is a drop down. This drop down is binded to a simple type string variable in the context. And this simple type contains two values.

For eg

1)Text1

2) Text2

Now my requirement is that when i push a button, i need to have these two values in two respective context variables so that i can use it later in a different screen.

Actually this field in drop down is a user field to which when dynamically set the variables will be available for setting a UWL task dynamically.

What should be my code to achieve the above?

Thnks

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

There is a property called 'selectedKey' for the dropdownbyKey UI element. Bind it to a context attribute of type string. This selectedKey determines the value from a value set. (The value which you select from the DropDownByKey will get saved in this context).

Former Member
0 Kudos

Hi Anagha,

Yes you are right.

But please note a point that there are two data rows in the table.

When i refer to the selectedKey in my code, what row will it refer to?

I need to knowing what row it is referring to since it is important for a further logic.

Former Member
0 Kudos

Can you not bind the selected keys of both the drop downs to separate context variables?

Also there is an event which is triggered when the user selects a list entry from the dropdown list box. You have the option of handling the event "onSelect" (i.e, if there are set of things that you wish to perform on selection).

For this event:

Event Parameter = key (Key of the selected entry)

Type = String

Former Member
0 Kudos

Hi Anagha,

Drop Down belongs to a table.

So virtually it means there is only mean one table drop down at design time. So at design time i can bind it to only one context variable.

Yes the 'onSelect' event is there.

Actually i have a buttton too. My situation is such that in my button action needs to give me selected values from the two drop downs (in two data rows).

This can happen only at runtime.

Is it so that i can loop around the table, and refer to a row using a row key and then select the context variable by referring to drop down element of that row?

Former Member
0 Kudos

Oops forgot that you have dropdown as table cell editor...

In this case.. when you select a value in one dropdown, does the same appears in 2nd dropdown also?

Former Member
0 Kudos

Hi,

In the onAction of the button, implement the below given code.

int j = wdContext.nodeVn_table().size();

for (int i=0 ; i< j; i++ )

{

IPrivate< >View.IVn_tableElement elem = wdContext.nodeVn_table().getVn_tableElementAt(i) ;

String colmn = elem.getVa_<dropDownAttr>();

wdComponentAPI.getMessageManager().reportSuccess(colmn);

}

Here i am printing the values selected in the dropdown.

Regards,

Jithin

pravesh_verma
Active Contributor
0 Kudos

Hi Yigesh,

Very easy code, check this out..

As you have a attribute named let say : Owner which has the dropdown (I have taken the reference from your earlier post) and the node name as ActivityTable.

You you just need to do this:



int size = wdContext.nodeActivityTable().size();
	  String valueOwner = null;
	  for (int i = 0; i < size; i++) {
		IActivityTableElement activityEle = wdContext.nodeActivityTable().getActivityTableElementAt(i);
		valueOwner = activityEle.getOwner();
		wdThis.wdGetAPI().getComponent().getMessageManager().reportSuccess("value of row" +i + "=" +valueOwner);
	

I hope this helps!!

Thanks and Regards

Praevsh

Former Member
0 Kudos

Hi Pravesh,

Thanks a lot for your reply. If i get the understanding of code right

int size = wdContext.nodeActivityTable().size();

String valueOwner = null;

for (int i = 0; i < size; i++) {

IActivityTableElement activityEle = wdContext.nodeActivityTable().getActivityTableElementAt(i);

valueOwner = activityEle.getOwner();

wdThis.wdGetAPI().getComponent().getMessageManager().reportSuccess("value of row" +i + "=" +valueOwner);

Does size here mean = number of rows in the table row at runtime? Or is it number of attributes under node?

I guess it is number of row data at runtime

This means that we are looping throught whatever number of data rows in the table at then at each loop we are referring the owner column and retrieving the values?

pravesh_verma
Active Contributor
0 Kudos

Hi,

Yes it is number of rows. You have understood it corerctly. I hope this solves your issue.

Please note that whenever you want to check for the number of rows then you just need to calculate the size of the node which is binded to the table.

While iterating over the node you can get the elements of the node which corresponds to each row.

Therefore:

1st Element <-------> 1st Row

2nd Element <-------> 2nd Row

3rd Element <-------> 3rd Row

So if you want to know the attribute values of a particular row just get that element number and then get the valueof the attribute which you want. This is what your exact requirement was..

I hope this helps!!

Thanks and Regards,

Pravesh

Former Member
0 Kudos

Thanks a lot Pravesh, Jithin, and Anagha

Edited by: Yogesh Bhatia on Mar 20, 2009 4:36 PM

Former Member
0 Kudos

Hi Yogesh,

The post of mine that you have rewarded as helpful is actually a question to you

You may please remove the points and answer the question instead for me

Regards,

Anagha

Former Member
0 Kudos

Hi Anagha,

I did it by mistake.

My purpose of awarding you was your hints that helped me and the availability of you to give your time and answer my queries.

So i have changed the assignment to other message of yours

My question is answered

Former Member
0 Kudos

Yes both the dropdowns are similar.

However the value selected in either of the drop downs can be different.

So i need to refer each row uniquely so that i can retrieve the values.

Thnks anywys

Former Member
0 Kudos

Ok

But I was still curious to know when you select a value in one dropdown, does the same appear in 2nd dropdown also for you? I don't have Server available at the moment to try it out myself.

Thanks & Good luck!

Anagha

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi,

Could u pls share the soln wid me too..

Regards,

Malita

Former Member
0 Kudos

Hi Yogesh

Sorry for hijacking this thread, but I noticed in your opening post that you mentioned:

...for setting a UWL task dynamically.

I am looking for a way to create arbitrary UWL tasks from a Java web-dynpro application (when certain events occur in our application).

I've not had any luck with this yet... ([my previous thread|/message/6398613#6398613 [original link is broken]])

If you've managed to get this working, could you please share your solution?

It would be greatly appreciated.

Thanks

Kind regards,

Rudolf