cancel
Showing results for 
Search instead for 
Did you mean: 

dropdownByindex onselect action problem

0 Kudos

Hi experts,

i have the following problem. I have created a dropdownbyindex element. I have implemented onSelect Action so, that if user select some element in this dropdown list this element will be copied in some input field above. So it's working by the way , but there is a stange behaivor as i have noticed.

For example i have my inputField :Projects

And dropdownindex element below with the lable:Available Projects:

So i write at first something in inputField Projects, push enter->onEnter Action is called and Data (projectnames) für DropdownIndex are loaded according to input in inputField Projects.

I can see my first element result in DropdownBykey. For example, i want to select this first element->onSelect Action schould be called to get this result element in Input Field Projects.

Unfortunately it does not work.

Only if i select at first some other result Element in list and only after that this first element it works.

Have you any idea, how i can solve this problem?

Thank you very much in advance!

Best regards,

Daria

Accepted Solutions (1)

Accepted Solutions (1)

former_member201361
Active Contributor
0 Kudos

Hi,

Please tell me whether I am Clear with ur requirements .

In the Input Field Preojects, User can enter the Project name , so the Onenter Action is called and Finlly the Drop down List is Populated .here u can select the Project name . again the Onselect Event is triggered , the selected value is Copied to another Input Field (Some more Details about ur requirements).

Thanks and Regards

Fazal B

0 Kudos

Hi,

fast the same i mean.

Only this "the selected value is Copied to another Input Field" . It's copied to the "the Input Field Preojects".

thank you & regards,

Daria

former_member201361
Active Contributor
0 Kudos

Hi,

So on the select of the Drop down u want the value to the input field Projects .

On the Event (OnSelect) :

Set the Selected Value of the Drop down to the Input field .

ie U might have binded the Context Attribute to the Input Field For eg (Test).

wdContext.currentContextElement.setTest(wdContext.nodeDropDownNode.getselectedKey Attribute())

Please make sure whether i am clear wilth ur requirements.

Thanks and Regards

Fazal B

0 Kudos

Hi,

i have made this way:

int selectedElemIndex=wdContext.nodeCC_Project().getLeadSelection();

IPrivateFilterDate.ICC_ProjectElement elem =(IPrivateFilterDate.ICC_ProjectElement) wdContext.nodeCC_Project().getElementAt(selectedElemIndex);

if(elem!=null){

wdContext.currentContextElement().setProjectname(elem.getName());

}

The Problem is not that i can't select, the problem is only with first element in dropDown list.

For a example i have this resultlist with projectnames: nw, nwOne, nwTwo . So the first project: nw is seen on dropdownindex as input. If i drop down the list and try to select this nw i suppose onSelect Action is called and i see nw in inputfield proects. But it does not happen. Only if i at first select for example nwOne, i see my nwOne in inputfield proects. If i after that select nw again, only then i see it in inputfield proects.

I hope this explaination is helpful.

Thank you !

Best regards,

Daria

Hi Pradeep,

thank you for reply.

it' not an error by the first time,it's only so ,as no OnSelect Action is called.

I suppose that it's a dropDownbyIndex UI Element issue. If an element was already selected, i can't call an action onSelect any more.If i select some other element, the first is deselected and after that i can call again this onSelect Action...

Edited by: Daria Sosunova on May 7, 2008 3:39 PM

PradeepBondla
Active Contributor
0 Kudos

Hi,

try these...

1) initialize selectedElemIndex with zero

2) while populating dropdown by key put a "" blank as first element so that first time no elements will be there in drop down, then you can select nw (in your example).

(drop down UI element will be shown blank when it populate, when you drop it down the you will see the elements... I think you are viewing nw as default right? )

regards,

Pradeep

0 Kudos

Hi Pradeep,

thank you !

I have found some other solution with blank.

if i change selection property to: 0..n ,i have automatically this blank and can choose my first project and onSelect is working.

But for example i have choosen this nw project, i see it in inputfield projects.

As user i delete for example "w" in inputfield projects, i have only n as project. So i want to change it again to nw and select nw from list. So i drop down and select nw and onSelect is not working. I suppose, because it was already selected.

Thank you &Regards,

Daria

former_member201361
Active Contributor
0 Kudos

hi,

U can make the ProjectName Context Attribute to null then again set it to the Element selected in the drop down.

if the project name is of type String , set it to null.

In the Action OnSelect:

wdContext.currentContextElement.setProjectName(null);

int selectedElemIndex=wdContext.nodeCC_Project().getLeadSelection();

IPrivateFilterDate.ICC_ProjectElement elem =(IPrivateFilterDate.ICC_ProjectElement) wdContext.nodeCC_Project().getElementAt(selectedElemIndex);

if(elem!=null){

wdContext.currentContextElement().setProjectname(elem.getName());

}

Thanks and Regards

Fazal B

PradeepBondla
Active Contributor
0 Kudos

Hi,

Try as fazal said and also invalidate() the node.

by this i hope you can solve the issue...

regards,

Pradeep

0 Kudos

Hi,

i tried to do it as Fazal said with(null), but nothing changes..

Why schould i invalidate my node? If i do so, i have no data any more. OnEnter i load this Data in Node for Dropdownby Index. If in action onSelect i delete it ,have nothing to display.

Could it be i don't understand correct, that you mean?

Thank you and Regards,

Daria

former_member201361
Active Contributor
0 Kudos

hi,

Let us see whether we are able to get the first selected Value from the drop down.

(Use message manager:)

In the Action OnSelect:

wdContext.currentContextElement.setProjectName(null);

int selectedElemIndex=wdContext.nodeCC_Project().getLeadSelection();

IPrivateFilterDate.ICC_ProjectElement elem =(IPrivateFilterDate.ICC_ProjectElement) wdContext.nodeCC_Project().getElementAt(selectedElemIndex);

wdComponentAPI.getMessageManager().reportSuccess(elem.getName());

if(elem!=null){

wdContext.currentContextElement().setProjectname(elem.getName());

}

Thanks and regards

Fazal B

PradeepBondla
Active Contributor
0 Kudos

Hi,

I mean to say if you refresh the node, already selected values (lead selection) will be invalidated and you can select nw again as new selection.

regards,

Pradeep

PradeepBondla
Active Contributor
0 Kudos

Hi,

problem solved? or still getting same?

regards,

Pradeep

former_member201361
Active Contributor
0 Kudos

hi,

Lets try it in this way ,

In the Action OnSelect:

String test = wdContext.currentContextElement.getProjectName();

if (test == null){

// do Nothing

}

else {

//set it to null.

wdContext.currentContextElement.setProjectName(null);

}

int selectedElemIndex=wdContext.nodeCC_Project().getLeadSelection();

IPrivateFilterDate.ICC_ProjectElement elem =(IPrivateFilterDate.ICC_ProjectElement) wdContext.nodeCC_Project().getElementAt(selectedElemIndex);

wdComponentAPI.getMessageManager().reportSuccess(elem.getName());

if(elem!=null){

wdContext.currentContextElement().setProjectname(elem.getName());

}

Thanks and regards

Fazal B

Former Member
0 Kudos

Hi Daria,

In action event handler you can try following:

int selectedElemIndex=wdContext.nodeCC_Project().getLeadSelection();

IPrivateFilterDate.ICC_ProjectElement elem =(IPrivateFilterDate.ICC_ProjectElement) wdContext.nodeCC_Project().getElementAt(selectedElemIndex);

if(elem!=null){

wdContext.currentContextElement().setProjectname(elem.getName());
}

wdContext.nodeCC_Project().setLeadSelection(-1);

I have added the line code wdContext.nodeCC_Project().setLeadSelection(-1); extra into what you have written. This line must also be written in your wdDoInit

Regards,

Gopal

0 Kudos

Hi Gopal,

Thank you very very much, it's working now with

wdContext.nodeCC_Project().setLeadSelection(-1); which i added in OnSelect and also in OnEnter where i load Data. Also selection of Node must be : 0..n otherwise exception appeared.

But it's also good with blank element for my problem.

Thank you very much at all who has helped with this issue!

Kind regards,

Daria

Former Member
0 Kudos

Hi,

After populating DropDown, add one more dummy element at

0'th location. Like this....

IPrivate<ViewName>.I<DDNodeName>Element ele=wdContext.create<DDNodeName>Element();

ele.set<Value>("-- Select--");

wdContext.node<DDNodeName>().addElement(0,ele);

And finally setleadselection of node to 0

wdContext.node<DDNodeName>().setLeadSelection(0);

Regards

LakshmiNarayana

Answers (1)

Answers (1)

PradeepBondla
Active Contributor
0 Kudos

Hi,

If I am not wrong....

you done with every thing... only problem is, in dropdown by key results if you select first element first time then you are getting error. if you select some other element first and then select 1st element it works right?

i too had the same problem one year back....

I didnt remember exactly how I solved it..... but it was with for loop where I display the elements in drop down. check it properly some small thing might be missing.

check the cordinality also... put it 1..n

regards,

Pradeep