Skip welcome & menu and move to editor
Welcome to JS Bin
Load cached copy from
 
<!DOCTYPE HTML>
<html>
<head>
<script src="https://openui5.hana.ondemand.com/resources/sap-ui-core.js" id="sap-ui-bootstrap" data-sap-ui-theme="sap_bluecrystal" data-sap-ui-libs="sap.m"></script>
<meta name="description" content="UI5:Using a delegate to implement jQueryUI dragable" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <title>Drag and drop using a delegate</title>
    <script type="text/javascript">
    sap.ui.require([
           'sap/m/Button',
           "sap/ui/base/Object",
           'sap/ui/thirdparty/jqueryui/jquery-ui-core',
           'sap/ui/thirdparty/jqueryui/jquery-ui-widget',
           'sap/ui/thirdparty/jqueryui/jquery-ui-mouse',
           'sap/ui/thirdparty/jqueryui/jquery-ui-draggable',
           'sap/ui/thirdparty/jqueryui/jquery-ui-sortable'
        ], function (Button, UI5Object) {
            "use strict";
            /*global jQuery, sap, my*/
           
           // create a delegate object which adds draggable to dom
           UI5Object.extend("DraggableDelegate",{
                constructor : function(oControl) {
                    this.oControl = oControl;
                },
                 onAfterRendering: function() {
                    this.oControl.$().draggable({
                        cancel: false
                    });
                }
           });
           // extend standard button and add the drag drop delegate on init
           Button.extend("MyButton", {
                renderer: {},
                init: function() {
                    this.oDraggable = new DraggableDelegate(this);
                    this.addDelegate(this.oDraggable);
                }
            });
            var oButton1 = new MyButton({
                text: "Drag Me"
            });
         
            var oButton2 = new MyButton({
                text: "Me too!"
            });
            oButton1.placeAt('content');
            oButton2.placeAt('content');
        });
    </script>
</head>
<body>
    <div id='content'></div>
</body>
</html>
Output

You can jump to the latest bin by adding /latest to your URL

Dismiss x
public
Bin info
anonymouspro
0viewers