1. #1
    Ext JS Premium Member
    Join Date
    Jun 2011
    Location
    Ottawa, Ontario, Canada
    Posts
    123
    Vote Rating
    1
    whalethewise is on a distinguished road

      0  

    Default Namespace and Ext.define problem

    Hi

    Are there any changes for using Ext.namespace and Ext.define in 4.1? Could Ext.data.Store be extended?

    As it worked for me in 4.0.7, now I have issues with 4.1 finding the class in predefined namespace.
    What could be wrong in my following code in 4.1 prospective?

    Code:
    Ext.namespace('com.myclass.store'); 
    Ext.namespace('com.myclass.model'); 
    
    Ext.define('com.myclass.store.KeyValueListStore', {
       extend: 'Ext.data.Store',
       constructor: function(config) {
          config = config || {};
          config.fields = ['key','value', 'selected'];
          if (config.autoLoad == undefined)
          {
             config.autoLoad = true;
          }
          config.clearOnLoad = true;
          config.proxy = {
             type: 'ajax',
             reader: {
                type: 'json',
                root: 'kvlist'
             },
             listeners: {
                exception: function(proxy, exception, operation) {
                   alert('1');
                }
    
    
             }
          };
          config.sorters = [
             {
                property: 'value',
                direction: 'ASC',
                transform: ignoreCaseSort
             }
          ];
          config.proxy.url = myurl + 'kvlist/' + config.proxyUrl;
          this.callParent([config]);
       },
       setProxyUrl: function(urlName) {
          this.proxy.url = contentlibraryUrl + 'kvlist/' + urlName;
       }
    });
    
    var mystore = Ext.create('com.myclass.store.KeyValueListStore', {
        proxyUrl: 'test'
    });
    Last edited by skirtle; 30 Jan 2012 at 9:59 PM. Reason: Added CODE tags

  2. #2
    Sencha - Sr Software Engineer mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    38,402
    Vote Rating
    1103
    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

    You shouldn't need to use Ext.ns/Ext.namespace. Ext.define should do that automatically.
    Mitchell Simoens @SenchaMitch
    Sencha Inc, Senior Software Engineer
    ________________
    Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
    https://github.com/mitchellsimoens

    Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/

    Need more help with your app? Hire Sencha Services services@sencha.com

    Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is in print!

    When posting code, please use BBCode's CODE tags.

  3. #3
    Ext JS Premium Member
    Join Date
    Jun 2011
    Location
    Ottawa, Ontario, Canada
    Posts
    123
    Vote Rating
    1
    whalethewise is on a distinguished road

      0  

    Default

    is it new for 4.1?

  4. #4
    Sencha - Sr Software Engineer mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    38,402
    Vote Rating
    1103
    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

    Quote Originally Posted by whalethewise View Post
    is it new for 4.1?
    No, to 4.x yes. I have been using Ext.define without using Ext.ns for a year now
    Mitchell Simoens @SenchaMitch
    Sencha Inc, Senior Software Engineer
    ________________
    Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
    https://github.com/mitchellsimoens

    Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/

    Need more help with your app? Hire Sencha Services services@sencha.com

    Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is in print!

    When posting code, please use BBCode's CODE tags.

Thread Participants: 1