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
    5
    Vote Rating
    0
    n-dee is on a distinguished road

      0  

    Default Problem with Draggable in ST2.2.0 rc

    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 - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    37,649
    Vote Rating
    898
    mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute

      0  

    Default


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

  3. #3
    Sencha User
    Join Date
    Jan 2012
    Location
    London, UK
    Posts
    508
    Vote Rating
    74
    shepsii is a jewel in the rough shepsii is a jewel in the rough shepsii is a jewel in the rough shepsii is a jewel in the rough

      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
    5
    Vote Rating
    0
    n-dee is on a distinguished road

      0  

    Default


    Thanks shepsii! Your fix works perfect for me!

Thread Participants: 2

Tags for this Thread