Threaded View

  1. #1
    Sencha - Support Team keckeroo's Avatar
    Join Date
    Mar 2008
    Location
    Winnipeg, Canada
    Posts
    292
    Answers
    4
    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 ;-).

Thread Participants: 2

Tags for this Thread