#PRIM_MD.Dropdown set selected VL-WEB

This Q&A forum allows users to post and respond to "How Do I Do ....." questions. Please do not use to report (suspected) errors - you must use your regional help desk for this. The information contained in this forum has not been validated by LANSA and, as such, LANSA cannot guarantee the accuracy of the information.
Post Reply
atostaine
Posts: 696
Joined: Wed Jan 20, 2016 7:38 am

#PRIM_MD.Dropdown set selected VL-WEB

Post by atostaine »

I have this code for a dropdown to set the current item to selected. I remember there was a bug that was fixed in an EPC when selecting the current item it would show the wrong column.

This code doesn't work to show the entry, even though I've seen it execute in debug

selectList #dropDown1
if (#SHACCO001 = #svShp)
#dropDown1.CurrentItem.visible #dropDown1.currentItem.selected := true
signal eShipperSelected pShipperNo(#ShAcco001)
leave
endIf
endSelect
Art Tostaine
BrendanB
Posts: 134
Joined: Tue Nov 24, 2015 10:29 am

Re: #PRIM_MD.Dropdown set selected VL-WEB

Post by BrendanB »

Art,

you have to do something like this:

Code: Select all

* CODE TO LOAD DROPDOWN:

#dropDown1.AddItem Value(#shpVal) Caption(#shpCaption)
#dropDown1.AddItem Value(#shpVal2) Caption(#shpCaption2)

* Below code sets the 'selected' item as #shpVal (first item i added).
#dropDown1.Value := #shpVal
so your code could be replaced with :

Code: Select all

#dropDown1.Value := #svShp
rather than having to iterate the list.

B.
atostaine
Posts: 696
Joined: Wed Jan 20, 2016 7:38 am

Re: #PRIM_MD.Dropdown set selected VL-WEB

Post by atostaine »

Thank you. I was looking in the docs! I promise.
Art Tostaine
atostaine
Posts: 696
Joined: Wed Jan 20, 2016 7:38 am

Re: #PRIM_MD.Dropdown set selected VL-WEB

Post by atostaine »

My Dropdown has 2 columns, customer name and number. Setting the value of the DD to the number doesn't work.

The dataclass parm doesn't let me set it to the number.

Is there something else I need to do?
Art Tostaine
BrendanB
Posts: 134
Joined: Tue Nov 24, 2015 10:29 am

Re: #PRIM_MD.Dropdown set selected VL-WEB

Post by BrendanB »

Art,

could you please share your code for creating the dropdown?

I wasnt aware that #prim_md.Dropdown allowed 2 columns....

B.
atostaine
Posts: 696
Joined: Wed Jan 20, 2016 7:38 am

Re: #PRIM_MD.Dropdown set selected VL-WEB

Post by atostaine »

Sorry, I didn't write this code and missed a lot of things here.

Here is the add to the dropdown. This is what I meant by columns. I need to use the correct words for the MD controls.

#DropDown.Items.Add( #shAcco001.AsString #shName )

I am able to set the current value, but something weird is happening. I set the value, but it doesn't appear until I mouse over the drop down. There are no mouse over events defined. I'm going to try it in a test web page to see if it's something with my RP.
Art Tostaine
BrendanB
Posts: 134
Joined: Tue Nov 24, 2015 10:29 am

Re: #PRIM_MD.Dropdown set selected VL-WEB

Post by BrendanB »

Ahh... gotcha...

#DropDown.Items.Add( #shAcco001.AsString #shName )

is the same as

#DropDown.Items.Add Value(#shAcco001.AsString) Caption(#shName)

(There is actually a 3rd Parameter 'Result' -- boolean ^H^H^H^H^H^H^H object to let you know that the add succeeded or failed.)

so to set the value you do:

#DropDown.Value := #shAcco001.AsString
Post Reply