I have seen other posts here about a LIST control on a UX going dirty, seemingly all by itself. So, I thought I'd mention this scenario where a ButtonList as a Detail Field for a LIST makes the list go dirty after user moves off of the first record in the LIST and the simple fix:
- An updateable LIST that uses mapped fields to controls on the UX
- One of the LIST's fields is mapped to a ButtonList control.
- The ButtonList is dynamically created by running an ajax callback in the UX's 'afterPrepare' event.
- The ButtonList only displays for, or applies to, some of the records in the LIST. The first record in the list never displays the ButtonList.
- the last bit of js code in 'onRenderComplete' selects the first row in the list to force the list to draw the detail fields for the first entry in the list. (This might be what is triggering the ux to go dirty, if it is not yet ready to work with the ButtonList.)
- js code for the afterDetailViewPopulate event in the LIST is run to show/hide/style various Detail Field controls and to set focus to the first editable detail field for the selected LIST record.
- The user can select a different record for editing by clicking a navigation button or by clicking a row in the LIST.
PROBLEM: The list always goes dirty when the user clicks off of or navigates off of the first row as indicated by the yellow triangle indicator that AA puts on the "dirty" row. The list is actually dirty the moment they come into the display, but the user does not have a visual indicator of this.
SOLUTION: Turn list detail debugging option on and compare the current field values to the ones "old" values listed on the bottom half of the debug box. I noticed that the only field that had a changed value was the field that was bound to the ButtonList. For some reason, perhaps due to the dynamic creation of my button list, the default db value of "-1" for my bound field was always getting changed to an empty string, "".
The easy solution is to create another field on the UX (I used simple text field that is in a hidden container) and to "map" the LIST field to that instead of directly to the button list. The ButtonList control maybe too complex to be properly mapped to a LIST field when dealing with a dynamically created ButtonList. In the LIST detail 'afterDetailViewPopulate' event put code to set the buttonlist value (use false parameter on setValue, so you don't turn the ux dirty). And in the onClick event for the ButtonList put in js to copy the Buttonlist value to the hidden ux control that maps back to the LIST.
- An updateable LIST that uses mapped fields to controls on the UX
- One of the LIST's fields is mapped to a ButtonList control.
- The ButtonList is dynamically created by running an ajax callback in the UX's 'afterPrepare' event.
- The ButtonList only displays for, or applies to, some of the records in the LIST. The first record in the list never displays the ButtonList.
- the last bit of js code in 'onRenderComplete' selects the first row in the list to force the list to draw the detail fields for the first entry in the list. (This might be what is triggering the ux to go dirty, if it is not yet ready to work with the ButtonList.)
- js code for the afterDetailViewPopulate event in the LIST is run to show/hide/style various Detail Field controls and to set focus to the first editable detail field for the selected LIST record.
- The user can select a different record for editing by clicking a navigation button or by clicking a row in the LIST.
PROBLEM: The list always goes dirty when the user clicks off of or navigates off of the first row as indicated by the yellow triangle indicator that AA puts on the "dirty" row. The list is actually dirty the moment they come into the display, but the user does not have a visual indicator of this.
SOLUTION: Turn list detail debugging option on and compare the current field values to the ones "old" values listed on the bottom half of the debug box. I noticed that the only field that had a changed value was the field that was bound to the ButtonList. For some reason, perhaps due to the dynamic creation of my button list, the default db value of "-1" for my bound field was always getting changed to an empty string, "".
The easy solution is to create another field on the UX (I used simple text field that is in a hidden container) and to "map" the LIST field to that instead of directly to the button list. The ButtonList control maybe too complex to be properly mapped to a LIST field when dealing with a dynamically created ButtonList. In the LIST detail 'afterDetailViewPopulate' event put code to set the buttonlist value (use false parameter on setValue, so you don't turn the ux dirty). And in the onClick event for the ButtonList put in js to copy the Buttonlist value to the hidden ux control that maps back to the LIST.