Page 1 of 1
#PRIM_MD.Dropdown set selected VL-WEB
Posted: Tue Nov 19, 2019 10:38 am
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
Re: #PRIM_MD.Dropdown set selected VL-WEB
Posted: Tue Nov 19, 2019 1:57 pm
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 :
rather than having to iterate the list.
B.
Re: #PRIM_MD.Dropdown set selected VL-WEB
Posted: Tue Nov 19, 2019 2:01 pm
by atostaine
Thank you. I was looking in the docs! I promise.
Re: #PRIM_MD.Dropdown set selected VL-WEB
Posted: Tue Nov 19, 2019 2:52 pm
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?
Re: #PRIM_MD.Dropdown set selected VL-WEB
Posted: Tue Nov 19, 2019 4:29 pm
by BrendanB
Art,
could you please share your code for creating the dropdown?
I wasnt aware that #prim_md.Dropdown allowed 2 columns....
B.
Re: #PRIM_MD.Dropdown set selected VL-WEB
Posted: Wed Nov 20, 2019 3:40 am
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.
Re: #PRIM_MD.Dropdown set selected VL-WEB
Posted: Wed Nov 20, 2019 10:47 am
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