Uploaded image for project: 'ZK'
  1. ZK
  2. ZK-1195

Add '@confirm' element to MVVM onXXXX event handler annotation to support user prompts before executing @command

XMLWordPrintable

    • Icon: New Feature New Feature
    • Resolution: Unresolved
    • Icon: Normal Normal
    • None
    • None
    • None
    • Any

      Inside a ZUL file using the MVVM @command annotation within a component event there is no way to include a preliminary prompt for the user to confirm the selected action.

      For example, assume that a user has a button called 'delete' and clicking on this will delete an entry from a list. Using the syntax...

      <button label="Delete" onClick="@command('delete')" />

      ... there isn't a way inside the ZUL to inject a preliminary prompt of the type "are you sure you want to delete?". The only way to achieve this is to use a Messagebox code inside the MVVM view class method. And that has to be bad as it injects GUI into what should be a non GUI method handler.

      One way of providing a preliminary prompt for @command actions would be to introduce a new '@confirm' annotation. Something like...

      <button label="Delete" onClick="@confirm(vm.confirmDelete,YES) @command('delete')" />

      The @confirm annotation would take two parameters:

      • a view model property of the type Messagebox
      • a Messagebox button value that is the value that confirms whether the process is to proceed onto the @command step

            Unassigned Unassigned
            davout davout
            Votes:
            4 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated: