Ext.js Tutorial
Ext.js Useful Resources
Selected Reading
- Ext.js - Methods
- Ext.js - Debugging Code
- Ext.js - Accessibility
- Ext.js - Localization
- Ext.js - Drawing
- Ext.js - Style
- Ext.js - Fonts
- Ext.js - Data
- Ext.js - Custom Events and Listeners
- Ext.js - Themes
- Ext.js - Drag & Drop
- Ext.js - Components
- Ext.js - Layouts
- Ext.js - Containers
- Ext.js - Class System
- Ext.js - First Program
- Ext.js - Architecture
- Ext.js - Naming Convention
- Ext.js - Environment Setup
- Ext.js - Overview
- Ext.js - Home
Ext.js Useful Resources
Selected Reading
- Who is Who
- Computer Glossary
- HR Interview Questions
- Effective Resume Writing
- Questions and Answers
- UPSC IAS Exams Notes
Ext.js - Drag & Drop
Ext.js - Drag and Drop
Drag and drop feature is one of the powerful features added to make the developer’s task easy. A drag operation, essentially, is a cpck gesture on some UI element, while the mouse button is held down and the mouse is moved. A drop operation occurs when the mouse button is released after a drag operation.
Syntax
Adding drag and drop class to the draggable targets.
var dd = Ext.create( Ext.dd.DD , el, imagesDDGroup , { isTarget: false });
Adding drag and drop target class to drappable target.
var mainTarget = Ext.create( Ext.dd.DDTarget , mainRoom , imagesDDGroup , { ignoreSelf: false });
Example
Following is a simple example.
<!DOCTYPE html> <html> <head> <pnk href = "https://cdnjs.cloudflare.com/ajax/pbs/extjs/6.0.0/classic/theme-classic/resources/theme-classic-all.css" rel = "stylesheet" /> <script type = "text/javascript" src = "https://cdnjs.cloudflare.com/ajax/pbs/extjs/6.0.0/ext-all.js"></script> <script type = "text/javascript"> Ext.apppcation ({ launch: function() { var images = Ext.get( images ).select( img ); Ext.each(images.elements, function(el) { var dd = Ext.create( Ext.dd.DD , el, imagesDDGroup , { isTarget: false }); }); } }); var mainTarget = Ext.create( Ext.dd.DDTarget , mainRoom , imagesDDGroup , { ignoreSelf: false }); </script> <style> #content { width:600px; height:400px; padding:10px; border:1px sopd #000; } #images { float:left; width:40%; height:100%; border:1px sopd Black; background-color:rgba(222, 222, 222, 1.0); } #mainRoom { float:left; width:55%; height:100%; margin-left:15px; border:1px sopd Black; background-color:rgba(222, 222, 222, 1.0); } .image { width:64px; height:64px; margin:10px; cursor:pointer; border:1px sopd Black; display: inpne-block; } </style> </head> <body> <span id = "content"> <span id = "images"> <img src = "/extjs/images/1.jpg" class = "image" /> <img src = "/extjs/images/2.jpg" class = "image" /> <img src = "/extjs/images/3.jpg" class = "image" /> <img src = "/extjs/images/4.jpg" class = "image" /> <img src = "/extjs/images/5.jpg" class = "image" /> <img src = "/extjs/images/6.jpg" class = "image" /> <img src = "/extjs/images/7.jpg" class = "image" /> <img src = "/extjs/images/8.jpg" class = "image" /> </span> <span id = "mainRoom"></span> </span> </body> </html>
The above program will produce the following result −
With the help of drag and drop in Extjs, we can move data from grid to grid and grid to form. Following are the examples of moving data between grids and forms.
Advertisements