0

Drag and drop event

asked 2012-01-28 09:55:26 +0800

valmar gravatar image valmar
925 2 13
http://www.timo-ernst.net

Hey guys,

I'm looking for 2 event for drag and drop operations:

1. An event that gets fired when the D&D operation has started.
2. An event that gets called WHILE the user is dragging an item.

Are there such events in ZK? I've been searching for some time now but couldn't find anything.

delete flag offensive retag edit

13 Replies

Sort by ยป oldest newest

answered 2012-08-06 05:13:26 +0800

btorres gravatar image btorres
6

Hey guys!
Please help
As I can do to get event.getTarget () on the controller?

public void onStartDrag(Event event) {
Label label = (Label) event.getTarget();
}

when executing the method onStartDrag event.getTarget () is null.

link publish delete flag offensive edit

answered 2012-02-24 08:12:01 +0800

valmar gravatar image valmar
925 2 13
http://www.timo-ernst.net

Hm, can you provide a really simple, runnable example? (e.g. with ZK Fiddle)

link publish delete flag offensive edit

answered 2012-02-22 13:51:10 +0800

creata87 gravatar image creata87
197 2

..neata back :)

for example the layout is defined in an index.zul where <include /> is used and the applied controller sets the source of the include as page1.zul. the drag event defined in the page1.zul is not recognized in index.zul. if i understood correctly, by using include it crosses over desktops. so the above mentioned method with desktop will not cross desktops.

link publish delete flag offensive edit

answered 2012-02-22 08:07:16 +0800

valmar gravatar image valmar
925 2 13
http://www.timo-ernst.net

Neata,

what do you mean by "include"?

link publish delete flag offensive edit

answered 2012-02-21 17:26:56 +0800

creata87 gravatar image creata87
197 2

updated 2012-02-21 19:47:11 +0800

..neata means morning in romanian :)

by the way, $widget.desktop has a better coverage than $widget.parent. i'd recommend to use desktop instead

but desktop does not work when include is involved. does anyone know how can the original desktop of the include component be retrieved?

link publish delete flag offensive edit

answered 2012-02-21 15:30:28 +0800

valmar gravatar image valmar
925 2 13
http://www.timo-ernst.net

Nice,
but what's "neata"? :-)

link publish delete flag offensive edit

answered 2012-02-21 13:32:03 +0800

creata87 gravatar image creata87
197 2

updated 2012-02-21 13:32:32 +0800

ps: here are the widget packages if you wanna use panel (in zul.wnd) instead of label (in zul.wgt) for example, or any other zk components

have fun with it
iulia

link publish delete flag offensive edit

answered 2012-02-21 12:56:14 +0800

creata87 gravatar image creata87
197 2

updated 2012-02-21 12:57:23 +0800

..neata :p

found it! the specific call is made by the $widget in the javascript

zAu.send(new zk.Event($widget, 'onStartDrag', null));

replace it with $widget.parent that references the div, so that the function in the controller will simply be generalized for all labels :)
public void onStartDrag(Event event) {
    System.out.println("Dragging started!");
}

link publish delete flag offensive edit

answered 2012-02-18 19:13:28 +0800

creata87 gravatar image creata87
197 2

updated 2012-02-20 14:50:13 +0800

..you are right. it is general in the javascript code but it is specific in the controller on the label_test id

onStartDrag$label_test

link publish delete flag offensive edit

answered 2012-02-18 11:20:38 +0800

valmar gravatar image valmar
925 2 13
http://www.timo-ernst.net

Hm, did you test that code?
For me, it looks like if this line applies to ALL labels, so it is already generalized and not id-specific:

zul.wgt.Label.prototype.getDragOptions_ = ....

link publish delete flag offensive edit
Your reply
Please start posting your answer anonymously - your answer will be saved within the current session and published after you log in or create a new account. Please try to give a substantial answer, for discussions, please use comments and please do remember to vote (after you log in)!

[hide preview]

Question tools

Follow

RSS

Stats

Asked: 2012-01-28 09:55:26 +0800

Seen: 462 times

Last updated: Aug 06 '12

Support Options
  • Email Support
  • Training
  • Consulting
  • Outsourcing
Learn More