Hi,

with .drag("span") you tell the drag source that drags should start on span tags.

><div wicket:id="container" class="container">
> <table>
> <tr>
> <td>www</td>
> <td>aaa</td>
> <td>aaa</td>
> </tr>
> </table>
></div>

Do you have a span tag in your markup?

Sven

On 02/26/2012 04:50 PM, Dan12321 wrote:
I would like to use drag and drop functions in my wicket application.
Into my pom.xml I add: wicket-dnd (http://code.google.com/p/wicket-dnd/)

But my code do not work. Could you help me, please?

I have got table. In the first cell ("td") is "span" element. I want this
"span" drag and drop into another cell ("td") in the table.
Thanks for help.

WebMarkupContainer container = new WebMarkupContainer("container");
                Model<String>  model = Model.of(new String("AAA"));
                container.add(new DragSource(Operation.values()) {
                          public void onAfterDrop(AjaxRequestTarget target, 
Transfer transfer) {
                                
                                  System.out.println("AAAAA");
                                
                          }
                        }.drag("span"));
                
                container.add(new DropTarget(Operation.values()) {
                          public void onDrop(AjaxRequestTarget target, Transfer 
transfer,
Location location) {
                            // add transfer data
                                
                                  System.out.println("rrrr");
                          }
                        }.dropCenter("td"));
                
                Label label = new Label("aaa", model);
                label.setOutputMarkupId(true);
                container.add(label);
                
                add(container);

and HTML:


<div wicket:id="container" class="container">
        
                <table>
                        <tr>
                                <td>www</td>
                                <td>aaa</td>
                                <td>aaa</td>
                        </tr>
                </table>
        
        </div>

--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/help-with-drag-and-drop-wicket-dnd-tp4422338p4422338.html
Sent from the Users forum mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to