Hi Wim,

Thank you for this fix it works fine here.

Concerning the weird JSlot construction, I must admit that your method is clearly more effective , I will replace them.

Best regards,

BA.

Hello Bastien,

Weird that jquery looks at what the default drag handler does, but this fixes it:

containerJq->doJavaScript("document.body.ondragstart=null;");
containerJq->doJavaScript("$('#" + containerJq->id() + "').draggable();");

The second doJavaScript call can replace that weird JSlot construction, right?

Br,
Wim.



2013/4/24 Bastien Amiel <[email protected] <mailto:[email protected]>>

    Hi,

    I'm using Wt with jquery and jquery ui.

    It usually goes well, but I need to use the "draggrable" function
    of jquery ui and it seems that something in the <body> generated
    by Wt make
    the widget unmovable.

    The following code generate a simple example of what the problem is.
    - When dragging, the element add the class
    ".ui-draggable-dragging" and remove it instantaneously.

    Is there a mouse event handler in the <body> that could negate the
    draggable behaviour of jquery ui plugin ?

    If I dynamically move the draggable container (in the html tree
    with chrome inspector / elements) at the same level as <body>, the
    draggable behaviour works well. That is why I suspect root() element.

    Thank you.

    Ps : using setDraggable on the container is not an option (this
    would work, but I can't).
    FYI : draggable doc <http://jqueryui.com/draggable/> for jquery-ui

    #include <Wt/WApplication>
    #include <Wt/WContainerWidget>
    #include <Wt/WText>

    using namespace Wt;

    class JavascriptExample : public WApplication
    {
       public:
         JavascriptExample(const WEnvironment& env);
    };

    JavascriptExample::JavascriptExample(const WEnvironment& env)
       : WApplication(env)
    {
       WContainerWidget * containerJq = new WContainerWidget(root());
       containerJq->setStyleClass("containerjq");
       containerJq->addWidget(new WText("widget Jq Draggable"));

       requireJQuery("resources/js/jquery-1.9.1.js");
       requireJQuery("resources/js/jquery-ui.js");

       JSlot testslot("function 
test(e,a){$(document).ready(function(){$($('.containerjq')).draggable();});}");
       testslot.exec();
    }

    WApplication *createApplication(const WEnvironment& env)
    {
       return new JavascriptExample(env);
    }

    int main(int argc, char **argv)
    {
       return WRun(argc, argv, &createApplication);
    }

------------------------------------------------------------------------------
Try New Relic Now & We'll Send You this Cool Shirt
New Relic is the only SaaS-based application performance monitoring service 
that delivers powerful full stack analytics. Optimize and monitor your
browser, app, & servers with just a few lines of code. Try New Relic
and get this awesome Nerd Life shirt! http://p.sf.net/sfu/newrelic_d2d_apr
_______________________________________________
witty-interest mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/witty-interest

Reply via email to