1. #1
    Sencha - Support Team keckeroo's Avatar
    Join Date
    Mar 2008
    Location
    Winnipeg, Canada
    Posts
    300
    Answers
    5
    Vote Rating
    9
    keckeroo will become famous soon enough

      0  

    Default Answered: Proper inclusion of DateExtras ?

    Answered: Proper inclusion of DateExtras ?


    Arrggh - ran into another gotcha with lack of documentation ;-)

    Code:
    Ext.Loader.setConfig({ 
        enabled: true 
    });
    
    Ext.setup({
        requires: 'Ext.DateExtras'
    });
    
    MyApp = new Ext.application({
        name: 'MyApp',
    
        views: [ 'Main' ],
        controllers: [ 'Main', 'Login', 'Profiles', 'Carousel', 'Messages' ],
        models: [ 'Message', 'Photo', 'Profile' ],
    
        launch: function() {
        }
         
    });
    Above code is based on a few example apps that are distributed with Sencha Touch - and I love the simplicity of this way of starting the app. BUT - according to current docs - DateExtras is included by adding the Ext.setup command shown above. I get an error 'Ext.setup has already been called before'.

    Any help would be greatly appreciated .. and updates to docs too !!! ;-)

    Cheers,

    Kev

  2. Hi Mitchell,

    I can always look to you to provide answers - and I'm very thankful for that. I did, however, find my answer through poking around and debugging.

    The proper use is :

    Code:
    Ext.Loader.setConfig({ 
        enabled: true 
    });
    
    MyApp = new Ext.application({
        name: 'MyApp',
    
        requires: [ 'Ext.DateExtras'],
    
        views: [ 'Main' ],
        controllers: [ 'Main', 'Login', 'Profiles', 'Carousel', 'Messages' ],
        models: [ 'Message', 'Photo', 'Profile' ],
    
        launch: function() {
        }
         
    });
    I initially tried this - and well - many things have changed with date functions which is why the code appeared broken but it wasn't. I just had to update all my calls and things worked

    eg - (date).parseDate is now Ext.Date.parse(...)
    (date).format is now Ext.Date.format(...)
    and so on ...

    So much to watch out for when upgrading to new versions ... lol.
    (grabs more tylenol w/ codeine and continues on - thank god codeine is 'over-the-counter' here in Canada ;-).

  3. #2
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    37,064
    Answers
    3497
    Vote Rating
    851
    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


    Yeah, you cannot use Ext.setup and Ext.application together. I'm not sure why we have DateExtras separate honestly.
    Mitchell Simoens @SenchaMitch
    Sencha Inc, Senior Forum Manager
    ________________
    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.

  4. #3
    Sencha - Support Team keckeroo's Avatar
    Join Date
    Mar 2008
    Location
    Winnipeg, Canada
    Posts
    300
    Answers
    5
    Vote Rating
    9
    keckeroo will become famous soon enough

      0  

    Default


    Hi Mitchell,

    I can always look to you to provide answers - and I'm very thankful for that. I did, however, find my answer through poking around and debugging.

    The proper use is :

    Code:
    Ext.Loader.setConfig({ 
        enabled: true 
    });
    
    MyApp = new Ext.application({
        name: 'MyApp',
    
        requires: [ 'Ext.DateExtras'],
    
        views: [ 'Main' ],
        controllers: [ 'Main', 'Login', 'Profiles', 'Carousel', 'Messages' ],
        models: [ 'Message', 'Photo', 'Profile' ],
    
        launch: function() {
        }
         
    });
    I initially tried this - and well - many things have changed with date functions which is why the code appeared broken but it wasn't. I just had to update all my calls and things worked

    eg - (date).parseDate is now Ext.Date.parse(...)
    (date).format is now Ext.Date.format(...)
    and so on ...

    So much to watch out for when upgrading to new versions ... lol.
    (grabs more tylenol w/ codeine and continues on - thank god codeine is 'over-the-counter' here in Canada ;-).

  5. #4
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    37,064
    Answers
    3497
    Vote Rating
    851
    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


    I'm very happy that we aren't adding to the native prototypes like to Date and Array and such. We now have our additions in the Ext namespace.
    Mitchell Simoens @SenchaMitch
    Sencha Inc, Senior Forum Manager
    ________________
    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.

  6. #5
    Sencha User
    Join Date
    Dec 2012
    Posts
    13
    Vote Rating
    0
    JackThor is on a distinguished road

      0  

    Default Trouble

    Trouble


    So I tried doing the way that Keckeroo was doing it but it not working for me I still get a complaint that my Date object doesn't have the method clearTime.
    Code:
    Ext.Loader.setConfig({            enabled:true
            });
            Ext.application({
            requires:['Ext.DateExtras'],
            name: "GS",
    Am I doing the requires in the

  7. #6
    Sencha User
    Join Date
    Dec 2012
    Posts
    13
    Vote Rating
    0
    JackThor is on a distinguished road

      0  

    Default


    place or something. Sorry my post got submitted early.

Thread Participants: 2

Tags for this Thread