Sencha Touch make Dataview dynamic elements draggable -


I have a data view that is populated using a store and a template so that the process is dynamic. Then I want to make each container division (see template) dragable and want to use the following code. I just consider the container divs (image + name) to be draggable, but instead the whole data view is draggable. Wondering what I am doing?

  Ext.define ('MyApp.view.allImages', expand: 'Ext.dataview.DataView', xtype: 'cams', required: ['MyApp.store.images' ], Config: {title: 'test', store: 'images', baseCls:' camera-list ', itemTpl: [' id id = "camimage"> "," div class = "Image" style = "background-image: url ({fullimage})"> gt; & gt; / div & gt; ',' & lt; div class = "name" & gt; {address} & lt; / Doc: 'Topbar', Title: 'Gainsville'}, {xtype: 'toolbar', '

This is a problem with the lifetime of the component, you should wait until That is not provided by the dataview, so that you can access the elements.

  initialize: function () {this.callParent (arguments); Var me = this; Get // divs that we want to create dragable // set timeout (function (arguments) {var images = me.element.select ("div.image-dataview-item"); Ext.each (images.elements , Function (image element) {var draggable = new Ext.util.Draggable ({element: imageElement, listeners: {dragstart: function (self, e, startX, startY) {console.log ("test dragstart [" + startX + ":" + Starty + "]"};}, drag: function (auto, e, newx, newi) {console.log ("test drag [" + newx + ":" + new + "]");} , Drande: function (self, e, endX, endY) {console.log ("test dragend [" endx + ":" + endY + "]");}}}); draggable.setConstraint ({min: {x : -Infinity, Y: -Infinity}, max: {x: Infinity, y: infinite}}); draggable.group = 'base'; // default group for droppable draggable = reverse = true;});}, 1000);}    

Comments

Popular posts from this blog

excel vba - How to delete Solver(SOLVER.XLAM) code -

github - Teamcity & Git - PR merge builds - anyway to get HEAD commit hash? -

ios - Replace text in UITextView run slowly -