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

Drag and Drop (handle detached dragged element)

XMLWordPrintable

    • Icon: New Feature New Feature
    • Resolution: Won't Do
    • Icon: Normal Normal
    • None
    • 8.6.1
    • Components
    • Security Level: Jimmy
    • ZK 9.0.0 S0, ZK 9.5.1 S1

      the current drag and drop implementation doesn't handle ROD cases well - generally spoken; cases where the dragged node is detached before the ghost is dropped onto the target.
      Currently, when this happens a ComponentNotFound exception is thrown at server side, when creating the drop event.

      https://github.com/zkoss/zk/blob/v8.6.1/zk/src/org/zkoss/zk/ui/event/DropEvent.java#L43

      This gives the user little options to handle such cases gracefully or even handle them in a more robust way.

      A first step would be to change the implementation to use getComponentByUuidIfAny to avoid the exception, allowing the user to handle cases where the dragged component is NULL
      (to preserve backwards compatibility this could be a library property to enable or disable this behavior) (ZK-4314)

      A useful addition do this would be a general onDragStart event (available to all ZK component supporting drag and drop), This will allow the user to store the relevant dragged information at server side (in any kind of dynamic scenario), so that the dragged information is still available even if the dragged component is NULL during the onDrop event.
      (right now it is already possible to add a client side zwatch listener and handle this using custom events, the extra event would make this more convenient)

      The attachment contains a prototypic solution to handle such scenarios (e.g. a listbox with rod, or a component that detaches after starting to drag it). In order to avoid the ComponentNotFound exception it currently sets the dragged component to the same as the drop target - this would no longer be necessary if null values are allowed for the dragged component.

            DevChu DevChu
            cor3000 cor3000
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: