PRIM_MD.Dropdown Changed
Posted: Thu Oct 18, 2018 6:36 am
The "Changed" event on most PRIM_MD.* controls gets fired when the USER changes the value of the field. This does not seem to be the case with PRIM_MD.DropDown as the Changed event gets fired when the value is set.
This is causing all kinds of havoc with change detection.
I have a field that uses a PRIM_MD.DropDown visualization with a pick list.
Here is an example field (TestField)
Now, when I set that field in a Server Module
The "Changed" event fires on the client. Here is the full client
As I mentioned this is wrecking havoc on change detection because whereas all the other controls only fire the changed event when the USER changes the field, this is firing the event when the value is bound.
This does not seem to be true. https://docs.lansa.com/14/en/lansa016/p ... hanged.htm
Attached is an export demonstrating the behavior.
My question then, is how do I detect when the user has changed the value of a PRIM_MD.Dropdown?
This is causing all kinds of havoc with change detection.
I have a field that uses a PRIM_MD.DropDown visualization with a pick list.
Here is an example field (TestField)
Code: Select all
begin_com role(*EXTENDS #PRIM_OBJT)
begin_com role(*Visual #PRIM_EVEF) name(#VisualEdit) UsePicklist(False) ComponentVersion(1) Height(21) Width(323)
end_com
begin_com role(*picklist) name(#Picklist) NoMatchAction(ShowValue)
define_com class(#PRIM_PKIT) name(#PKIT_1) Value(1) Caption('One') Parent(#Picklist)
define_com class(#PRIM_PKIT) name(#PKIT_2) Value(2) Caption('Two') Parent(#Picklist)
end_com
begin_com role(*Visual #PRIM_MD.DropdownField) name(#DropdownField) DefaultVisual(True)
end_com
end_com
Code: Select all
begin_com role(*EXTENDS #PRIM_SRVM)
group_by name(#DoItFields) fields(#STD_TEXT #TestField)
srvroutine name(DoIt)
group_map for(*OUTPUT) group(#DoItFields)
#STD_TEXT := "This is a test from a server module"
#TestField := "2"
endroutine
end_com
Code: Select all
begin_com role(*EXTENDS #PRIM_WEB) Theme(#SYS_THEME<MaterialDesignBlue>)
define_com class(#PRIM_TBLO) name(#LayoutList)
define_com class(#PRIM_TBLO.Column) name(#LayoutListColumn1) DisplayPosition(1) Parent(#LayoutList)
define_com class(#PRIM_TBLO.Row) name(#LayoutListRow1) DisplayPosition(1) Parent(#LayoutList)
define_com class(#PRIM_TBLO.Item) name(#LayoutListItem1) Column(#LayoutListColumn1) Manage(#ListSTD_STRNG1) Parent(#LayoutList) Row(#LayoutListRow1) MarginBottom(5) MarginLeft(5) MarginRight(5) MarginTop(5)
define_com class(#PRIM_MD.RaisedButton) name(#Button) Caption('Do It!') DisplayPosition(1) Left(190) Parent(#COM_OWNER) TabPosition(1) ThemeDrawStyle('MediumTitle') Top(170) Width(179)
define_com class(#PRIM_MD.List) name(#List) DisplayPosition(2) LayoutManager(#LayoutList) Left(547) Parent(#COM_OWNER) RowHeight(48) TabPosition(2) ThemeDrawStyle('Card') Top(168)
define_com class(#PRIM_MD.ListLabel) name(#ListSTD_STRNG1) Caption('Standard string field') DisplayPosition(1) DragStyle(None) Left(5) Parent(#List) Source(#STD_STRNG) TabPosition(1) Top(5) Height(38) Width(268)
define_com class(#TestField.DropdownField) name(#TestField) DisplayPosition(3) Left(184) Parent(#COM_OWNER) TabPosition(3) Top(248)
group_by name(#DoItFields) fields(#STD_TEXT #TestField)
evtroutine handling(#Com_owner.Initialize)
endroutine
evtroutine handling(#Button.Click)
#COM_OWNER.DoTest
endroutine
mthroutine name(DoTest)
define_com class(#TestModule.DoIt) name(#doIt)
#doIt.ExecuteAsync DoItFields(#DoItFields)
evtroutine handling(#doIt.Completed)
#STD_STRNG := "DoIt Completed"
add_entry to_list(#List)
endroutine
endroutine
evtroutine handling(#TestField.Changed)
#STD_STRNG := "Test Field Changed"
add_entry to_list(#List)
endroutine
end_com
This does not seem to be true. https://docs.lansa.com/14/en/lansa016/p ... hanged.htm
Attached is an export demonstrating the behavior.
My question then, is how do I detect when the user has changed the value of a PRIM_MD.Dropdown?