cancel
Showing results for 
Search instead for 
Did you mean: 

using dropdownkey in table column

Former Member
0 Kudos

Hi Friends,

I am using a dropdownkey in a table column , which is bind to a dictionary enumeration ClaimType (of three values). I am displaying 10 editable rows to user . User can fill multiple rows with any of three selections and then can click save.

But The problem is , when user selects a dropdown value in a row, all others row too gets updated with the same value .

I am capturing the user selection in Onselect method. .

Its looks like that all the rows are attached to same instance of ClaimType. I am not getting how to bind diffferent rows with different instances .

Edited by: Vidit on Aug 1, 2008 4:42 PM

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi, could you try the following code to fill your dropdown?


for (int i = 0; i<5 ; i++)  // 5 in example
{
	wdContext.nodeYOURNODE().addElement(wdContext.nodeYOURNODE().createElement());
}

Edit: Sry, forgot you need another data inside the node aswell, so you should add them before the addElement line, which wont add an element created there but a previously created one.

Regards,

Julio H.

Edited by: Julio Cesar Herrera on Aug 1, 2008 10:38 AM

Note for correction.

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi,

you will get this problem if you bind the editable columns of the rows also to the dictionary type.

u can do like this,

1) create a node,

inside that create an attribute say 'select', bind it to a dictionary simple type you have created.

and create other attributes u want say 'edit1' ,1edit2' etc..in the context(as Mr. Armin suggested that the attribute to which you are binding the selected key property must be inside the datasource node..since you are getting the data from some node)

2)then, bind the selectedKey property of the dropdownbykey column of your table to the 'select 'property of the context ehich in turn is bound to a dictionary simple type enumeration.

3) then, bind the rest of the column's (i,e editable columns to the context attributes 'edit1'..etc.

hope this gave you some clarity

Regards,

Satya.

Former Member
0 Kudos

Hi Satya

This is exactly the way I have done so far but I am facing issue as I have decribed in my opeing thread. To give you more detail

When user selects something from dropdown column, say in row1, the same selection is copied to all other 9 rows (on ui interface only. In the context, the values are copied correctly) This problem I am facing because there is only one instance of the ClaimType ( of type simpletype enumeration) to which all 10 column instances in 10 rows is attached.

Do you have a solution for this ?

regards

vidit

Former Member
0 Kudos

Hi,

I have worked out the same example i am not getting that problem..

jus check out once again..

i guess u are going here:

ex: assume u have created a context as below

step1:

-


>DataSourceNode--

-


>select (bind this to a dic simple type)

-


>objj1

-


>objj2

-


>obj3

step2:

apply table template and select obj1,obj2,obj3

and change the editor property of obj1 to dropdown by key and obj2, obj3 to input type.

step3:

in the layout select the column obj1, there bind the selectedkey property of

the dropdown to the select attribute in the context.

and DONT bind obj2 and obj3 to select.

Regards,

Satya.

Edited by: Satya on Aug 2, 2008 1:25 PM

Edited by: Satya on Aug 2, 2008 1:27 PM

Former Member
0 Kudos

Hi Satya,

Are you using model node in your example ?

Former Member
0 Kudos

Hi,

yes i have used model node to check whether all the rows are changing.

Regards,

satya.

Edited by: Satya on Aug 2, 2008 1:48 PM

Former Member
0 Kudos

Hi Satya,

To instantiate the model node,

input = new Zhr_Expense1_Input();

com.sap.aii.proxy.framework.core.AbstractList inputObjlist = new Zhbilldtl.Zhbilldtl_List();

Zhbilldtl inputObj[] = new Zhbilldtl[11];

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

{

inputObj<i>= new Zhbilldtl();

}

input.setEmpno(uID);

input.setYear( (new Integer(Calendar.getInstance().get(Calendar.YEAR))).toString() );

input.setBilldtl(inputObjlist);

wdContext.nodeZhr_Expense1_Input().bind(input);

Context structure

context

-


nodeZhr_Expense1_Input

-


expense_input

-


ClaimTypeNode

-


claimtypeattrib

-


other attrib

I am taking the value from ClaimTypeattrib in onSelect action method to other context attribute.

Now please guide me how to create 10 instances of ClaimTypeNode for 10 rows. ?

Regards,

Vidit

Former Member
0 Kudos

Just set the following properties for the node "ClaimType" (I would not use the suffix "Node"):

- cardinality = 1:1

- selection = 1:1

- singleton = false

Then you will automatically have as many instances of this node as there are elements in its parent node "expense_input".

To access the "claimType" attribute for a "expense_input" element use code like


Iexpense_inputElement expense = ...;
expense.currentClaimTypeElement().getClaimType();

Armin

Former Member
0 Kudos

Hi Armin,

I have done as you have said but when I run the application ClaimType column is shown disabled. Looks like its context element i snot initialized.

can you please help ?

Regards

vidit

Former Member
0 Kudos

What is the exact context structure (including cardinalities and singleton properties), and how did you fill the context? Are the data in the other columns available?

Armin

Former Member
0 Kudos

Th exact Context structure is :

 
          zhr_Expense1_input (C= 0..n, Singleton= true)
---------------expense_input (C= 0..n, Singleton= true)
---------------------ClaimTP  (C= 1....1, Singleton= false)
--------------------------- ClaimAttrib
---------------------Billdt
---------------------Billno.
---------------empno.
---------------year

I am taking user input through editable table rows. So I have created place holders for expense_input by mentioned code in previous reply.

All other columns are visible and editable. If I hardcode the value for Claimtype, I am successfully able to update the records in R3 too.

Regards

Vidit

Edited by: Vidit on Aug 2, 2008 2:54 PM

Edited by: Armin Reichert on Aug 2, 2008 3:02 PM

Former Member
0 Kudos

Is the "selectedKey" property of the DropDownByKey correctly bound?

Armin

Former Member
0 Kudos

Yes, It is bound as below

selectedKey= Zhr_Expense1_Input.expense_input.ClaimTP.ClaimAttrib

I think its a very common scenario. I must be doing something wrong.

Regards

Vidit

Former Member
0 Kudos

Has node "ClaimTP" selection = 1:1?

Armin

Former Member
0 Kudos

yes it is 1:1.

Do I need to create instance for ClaimTP ? and how do i create it ?

Regards,

Vidit

Former Member
0 Kudos

No, you don't need to create this instances because cardinality is 1:*. The framework creates the instance automatically. Selection 1:1 means this single instance is always selected thus you can always access it's single element using currentClaimTPElement().

Can you loop over the parent node of ClaimTP? How many elements e does it contain and what are the values of e.currentClaimTPElement().getClaimType()?

Is the data type of attribute "claimType" correct (DDIC type with value set)?

Armin

Former Member
0 Kudos

Thanks for your help guys.

I evenually have solved the problem by creating a new value node for the table and saving to model node at the click of save button.

Former Member
0 Kudos

The context attribute to which the "selectedKey" property is bound must live inside the data source node of the table.

Armin

Former Member
0 Kudos

Thanks for the reply armin. thats definiltly the right way.

I have created my Node (of ClaimType) in the datasource node of the table.

Context

-


modelNode1

-


modelNode2 (datasource node for table

-


ClaimType(value node of type ClaimType enum)

-


and other attributes

Now the problem I am facing is , How to get the as many instances of node ClaimType as of modelNode2 ?

For modelNode2, I have created a Collection of 10 objects and have binded to it. But I am not getting how to add to include ClaimType in the collection ?

regards

Vidit