cancel
Showing results for 
Search instead for 
Did you mean: 

Dropdown by Index in a table - Mysterious behaviour

Former Member
0 Kudos

I have a dropdown by index column in a table

The node structure is:

V_Contractor (node)

- shift

- hours

|

V_ContractorSel (node) -> dropdownbyIndex

-name

V_Contractor:- cardinality 0:n and selection 1:1 singleton true

V_ContractorSel:- cardinality 0:n and selection 1:1 singleton false

The issue is that sometimes when i select the dropdown from row 7 of the table the dropdown for row 4 gets displayed. Then whenever i click anywhere on the table this dropdown for row 4 gets displayed.

Thanks for your help

Ashwin

Accepted Solutions (1)

Accepted Solutions (1)

roberto_tagliento
Active Contributor
0 Kudos

Check what do by code on view action/event/wdDoModify to your node.

Seem strange.

How do you access to <b>V_ContractorSel</b>?

use:

wdContext.currentV_ContractorElement.nodeV_ContractorSel()

???

Post your event/action code.

ashwin_bhat
Participant
0 Kudos

in WdDomodify a function "Calculatexxx" is called

In this function I have used for loop on the main node as follows

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

wdContext.nodeV_Contractor().moveTo(i);

if ((!(wdContext

.currentV_ContractorSelElement()

.getname()

== null)))

{

// Some code

}

}

Hence when i select any dropdown on any node the last dropdown also used to pop up because of the

last element being selected as lead selection after my for loop ends.

So to counter that situation, I created a context attribute called "LeadSelected".

In action for table "onLeadselect" I have set this as follows

wdContext.currentContextElement().setLeadSelected(

wdContext.currentV_ContractorElement().index());

And then I added the following code to the "Calculatexxx" function

for {

....

...

...

}

// added part

wdContext.nodeV_Contractor().moveTo(wdContext.currentContextElement().getLeadSelected());

roberto_tagliento
Active Contributor
0 Kudos

As i a guess.

<b>wdContext.<u>currentV_ContractorElement</u>.nodeV_ContractorSel()</b>

or

<b>wdContext.<u>currentV_ContractorElement</u>.currentV_ContractorSelElement()</b>

with Singleton, you must access to last child with its direct parent!

roberto_tagliento
Active Contributor
0 Kudos

With this:

<b>wdContext.currentV_ContractorSelElement()</b>

you have not your wished effect.

sorry edit

Message was edited by:

Roberto Tagliento

ashwin_bhat
Participant
0 Kudos

Thanks for your replies Roberto,

You are right. Hence in the dropdown onSelect event I have written

wdContext.nodeVContractorSel().setLeadSelection(currentIndex);

and in wdDoModify I have written

if (firstTime) { IWDDropDownByIndex l_drpDown =

(IWDDropDownByIndex) view.getElement("DrpDown_Name");

l_drpDown.mappingOfOnSelect().addSourceMapping("index", "currentIndex");

I believe this allows me to access the Name value with

wdContext.currentV_ContractorSelElement().getName();

Former Member
0 Kudos

Can you please tell exactly what you want to achieve and why you wrote this code inside wdDoModifyView()? Probably you can/should write all this code inside an event handler instead.

Armin

roberto_tagliento
Active Contributor
0 Kudos

No:

wdContext.nodeVContractorSel().setLeadSelection(currentIndex);

but do:

wdContext.<b>currentV_ContractorElement()</b>.nodeVContractorSel().setLeadSelection(currentIndex);

this is wrong:

wdContext.currentV_ContractorSelElement().getName();

do this:

wdContext.<b>currentV_ContractorElement()</b>.currentV_ContractorSelElement().getName();

ashwin_bhat
Participant
0 Kudos

Hello Armin,

In the doModifyView i have just written a code where in for the first time, it sets the index to p_index as -

if (firstTime) {

IWDDropDownByIndex l_dropDown =

(IWDDropDownByIndex) view.getElement("DrpDown_ServiceType");

l_dropDown.mappingOfOnSelect().addSourceMapping("index", "p_Index");

"V_UI_TextStatus"));

}

Please help.

Thanks,

Ashwin

roberto_tagliento
Active Contributor
0 Kudos

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

wdContext.nodeV_Contractor().moveTo(i);

if ((!(wdContext<b>.currentV_ContractorElement()</b>

.currentV_ContractorSelElement()

.getname()

== null)))

{

// Some code

}

}

otherwise is NULL or not the right V_ContractorSelElement

Message was edited by:

Roberto Tagliento

ashwin_bhat
Participant
0 Kudos

Hello Roberto,

This is Samta on behalf of Ashwin.

That was simply superb!!!!!!!!

I just changed the first as per your suggestion and yep it does work out fine

Thanks a lot for your efforts

Really appreciate your patience

Thanks,

Samta

roberto_tagliento
Active Contributor
0 Kudos

I know and see.

I said the same thing 4+1/2 times!!!!!

I am happy for you 😛

Message was edited by:

Roberto Tagliento

ashwin_bhat
Participant
0 Kudos

I knw

Thanks once again!!!

Former Member
0 Kudos

For a DropDownByIndex, this parameter mapping is rather useless because you can always get the selected index by asking the context node for its lead selection.

Armin

Answers (3)

Answers (3)

monalisa_biswal
Contributor
0 Kudos

I think u have binded datasource of table UI element to the subnode(whose singleton property is set to false)

Instead u bind it to the parent node.

Example:

Node A<-----Table's Data Source

---attr1

---attr2

-


Node B-(singleton false)

-


attr1<-----DropDownByIndex

ashwin_bhat
Participant
0 Kudos

Hi Monalisa,

Thanks for your assistance

Checked it. It's been binded to the main node as reqd.

ashwin_bhat
Participant
0 Kudos

Hey Roberto,

After rigorous testin, i found the issue still persists.

Lemme give it another try

Thanks,

Samta

roberto_tagliento
Active Contributor
0 Kudos

Noooo!!!

Really?!?!

Now have to go

Check on SINGLETON node, and usage.

Bye and good work

Former Member
0 Kudos
ashwin_bhat
Participant
0 Kudos

I have already done as mentioned in these posts but to no avail.