Looks like we cannot reproduce this. Please provide another test case to reproduce this issue.
  1. #1
    Sencha User
    Join Date
    Feb 2013
    Posts
    31
    Vote Rating
    0
    batman3000 is on a distinguished road

      0  

    Default Unable to set a singleton GridPanel in 4.2.0

    Unable to set a singleton GridPanel in 4.2.0


    ExtJS: 4.2.0

    Description:
    Setting the singleton property to true in a GridPanel results in a javascript error "Cannot read property 'isInstance' of undefined "

    Shouldn't we be able to do this? Unless I'm misunderstanding the point of the singleton pattern...

    Steps to reproduce
    1. Create a GridPanel class (using Ext.define)
    2. Set singleton = true
    3. Reload page

  2. #2
    Sencha - Ext JS Dev Team evant's Avatar
    Join Date
    Apr 2007
    Location
    Sydney, Australia
    Posts
    17,168
    Vote Rating
    674
    evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute

      0  

    Default


    What is the use case for defining a singleton component? With our class system it essentially means it's a static class.
    Evan Trimboli
    Sencha Developer
    Twitter - @evantrimboli
    Don't be afraid of the source code!

  3. #3
    Sencha User
    Join Date
    Feb 2013
    Posts
    31
    Vote Rating
    0
    batman3000 is on a distinguished road

      0  

    Default


    ??? Unless you're saying a gridpanel can't be a static class, then this is a bug.

    Did you try to replicate it?

  4. #4
    Sencha - Ext JS Dev Team evant's Avatar
    Join Date
    Apr 2007
    Location
    Sydney, Australia
    Posts
    17,168
    Vote Rating
    674
    evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute

      0  

    Default


    Yes, I tried to replicate it, it renders as expected:

    Code:
    Ext.define('Foo', {
        singleton: true,
        requires: ['Ext.*'],
        extend: 'Ext.grid.Panel',
        columns: [{
            text: 'Foo',
            dataIndex: 'foo'
        }],
        store: {
            fields: ['foo'],
            data: [{
                foo: 1
            }]
        }
    });
    
    Ext.onReady(function(){
        Foo.render(document.body);
    });
    As I said above though, it doesn't really make any sense to do this. The singleton configuration just instantiates the class at the point of construction and then overwrites the reference. It's similar to doing:

    Code:
    Ext.define('Foo', {
    });
    Foo = new Foo();
    Evan Trimboli
    Sencha Developer
    Twitter - @evantrimboli
    Don't be afraid of the source code!

Thread Participants: 1

Tags for this Thread