Results 1 to 4 of 4

Thread: Problem with Draggable in ST2.2.0 rc

    Success! Looks like we've fixed this one. According to our records the fix was applied for TOUCH-4291 in a recent build.
  1. #1
    Sencha User
    Join Date
    Oct 2011
    Posts
    6
    Vote Rating
    0
      0  

    Default Problem with Draggable in ST2.2.0 rc

    When I try to make a component draggable by setting "draggable: true", I get the following error in Chrome 26:

    Uncaught TypeError: Cannot call method 'setElement' of undefined
    (Draggable.js:164)

    To reproduce this, simply generate an app with the name "Test" in SenchaCmd and replace the view/Main.js with this code:


    Code:
    Ext.define('Test.view.Main', {    
        extend: 'Ext.Container',
        xtype: 'main',
        config: {
            items: [
                {
                    height: 300,
                    draggable: true,
                    style: 'background-color:red'
                }
            ]
        }
    
    });
    Am I doing something wrong or could this be a Bug?
    Thanks in advance.

  2. #2
    Sencha - Sr Software Engineer mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    39,335
    Vote Rating
    1297
      0  

    Default

    Thanks for the report! I have opened a bug in our bug tracker.

  3. #3
    Sencha Premium Member
    Join Date
    Jan 2012
    Location
    London, UK
    Posts
    587
    Vote Rating
    88
      0  

    Default

    same thing here. The translatable seems to be set to undefined in the draggable util's applyTranslatable method.

    *edit: the applyTranslatable method appears to be being called twice - once with the translatable argument correctly set, and once with it undefined. Obviously editing source is very ugly, but I'm going to go ahead and assume sencha will fix this for final release.

    Given that, this patch of applyTranslatable is doing the job for me (this is on line 162 of touch/src/util/Draggable.js):

    Code:
    applyTranslatable: function(translatable, currentInstance) {
            if (!Ext.isDefined(translatable)) {
                return;
            }
            translatable = Ext.factory(translatable, Ext.util.Translatable, currentInstance);
            translatable.setElement(this.getElement());
    
    
            return translatable;
        }
    I am sure Sencha can fix more eloquently by removing the incorrect call to this method!
    I blog about Sencha Touch at www.senchatouchdev.com

  4. #4
    Sencha User
    Join Date
    Oct 2011
    Posts
    6
    Vote Rating
    0
      0  

    Default

    Thanks shepsii! Your fix works perfect for me!

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •