Results 1 to 4 of 4

Thread: Unable to set a singleton GridPanel in 4.2.0

    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
      0  

    Default 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
    18,608
    Vote Rating
    874
      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
    Twitter - @evantrimboli

  3. #3
    Sencha User
    Join Date
    Feb 2013
    Posts
    31
    Vote Rating
    0
      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
    18,608
    Vote Rating
    874
      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
    Twitter - @evantrimboli

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
  •