I have a VL web dialog with two md dropdown components from lists.
The second dropdown list is dynamically built depending on the value in the first dropdown.
I have both dd lists initially built in the .Prepare event.
First execution of the dialog works fine, with the second dropdown populated with the expected values.
But, if I change the value in the first dropdown, how can I clear the previous values in the second dropdown, so it can then be repopulated from the new list values?
Currently:
dropdown #1 values are #source1 and #source2.
When dropdown #1 initially has the value of as #Source1, then
dropdown #2 is populated from a list that has values: #listItem1 and #listItem2.
If I change dropdwon#1 so that it's value is now #source2, this then builds a new list (with only a value of #listItem3) to use in dropdown #2, but instead of resulting in a fresh dropdown listing of only #listItem3, I end up with a dropdown#2 have the previous values, plus the new value - #listItem1, #listItem2, and #listItem3.
The working lists that are used to build the dropdowns are being cleared (clr_list) and a log output shows that the list only has the correct new value, it is just the MD Dropdown that I am not seeing how to clear it out before it is being rebuilt / repopulated?
how to clear PRIM_MD.Dropdown in a VL web dialog
how to clear PRIM_MD.Dropdown in a VL web dialog
Arlyn Dale
Servias LLC
Servias LLC
Re: how to clear PRIM_MD.Dropdown in a VL web dialog
Hi Dale,
With a removeall:
this code shows a dropdown with only C and D.
With a removeall:
Code: Select all
Define_Com Class(#PRIM_MD.Dropdown) Name(#Dropdown) Caption('Caption') DisplayPosition(1) Left(100) Parent(#COM_OWNER) TabPosition(1) Top(216)
(...)
#Dropdown.Items.Add Caption("AAAA") Value("A")
#Dropdown.Items.Add Caption("BBBB") Value("B")
#Dropdown.Items.RemoveAll
#Dropdown.Items.Add Caption("CCCC") Value("C")
#Dropdown.Items.Add Caption("DDDD") Value("D")Re: how to clear PRIM_MD.Dropdown in a VL web dialog
Why does the RemoveAll, not remove the last selected item in the drop down list.
Simple VL web test view with a drop down component and a button to clear the drop down:
When the view initially prepares to view, the dropdown is populated with the four entries.
When you click on the Clear button, the drop down retains the value of the first list from the prepare (if nothing had been selected) or it retains the selected value to still show / display in the drop down. The drop down list is now empty, but the screen or presentation still shows a value?
Is this the expected result? Or, should the RemoveAll, also remove the .value at the same time?
I am trying to think of a scenario where you would clear the drop down list (RemoveAll) and want to keep the previously selected value?
If you add in the evt routine of the #btClear.Click
#ddList.Value := (*blank)
Then the value of the dropdown and the list for the dropdown will now be all blank.
Simple VL web test view with a drop down component and a button to clear the drop down:
Code: Select all
EVTROUTINE Handling(#COM_OWNER.Prepare)
#ddList.Items.Add Value('item01')
#ddList.Items.Add Value('item02')
#ddList.Items.Add Value('item03')
#ddList.Items.Add Value('item04')
ENDROUTINE
EVTROUTINE Handling(#btClear.Click)
#ddList.Items.RemoveAll
#ddList.Items.Add( *blank )
ENDROUTINE
When the view initially prepares to view, the dropdown is populated with the four entries.
When you click on the Clear button, the drop down retains the value of the first list from the prepare (if nothing had been selected) or it retains the selected value to still show / display in the drop down. The drop down list is now empty, but the screen or presentation still shows a value?
Is this the expected result? Or, should the RemoveAll, also remove the .value at the same time?
I am trying to think of a scenario where you would clear the drop down list (RemoveAll) and want to keep the previously selected value?
If you add in the evt routine of the #btClear.Click
#ddList.Value := (*blank)
Then the value of the dropdown and the list for the dropdown will now be all blank.
Arlyn Dale
Servias LLC
Servias LLC