Results 1 to 5 of 5

Thread: Migrate version 1 to version 2

  1. #1
    Sencha User
    Join Date
    Oct 2012
    Posts
    13

    Default Migrate version 1 to version 2

    • [COLOR=red !important]Uncaught TypeError: Cannot use 'in' operator to search for 'override' in undefined sencha-touch-all.js:35[/COLOR]
      • [COLOR=red !important]Ext.apply.define[/COLOR]
      • [COLOR=red !important](anonymous function)[/COLOR] SearchResults.js


        I have this error for most of the file used in my project, for example in this model "SearchResults.js"
        Here is the code:

        Ext.define('App.model.SearchResults'), {
        // in version 1 it was: Ext.regModel('SearchResults', {

        extend:'Ext.data.Model',
        config:{
        fields: [
        {
        name: 'issue_id',
        type: 'int'
        },
        {
        name: 'issue_title',
        type: 'string'
        },
        {
        name: 'issue_date',
        type: 'string'
        },
        {
        name: 'number',
        type: 'int'
        },
        {
        name: 'count',
        type: 'int'
        }
        ]
        }
        };

        I replaced Ext.regModel with Ext.define.

        If you have any ideea why is not working please write me.
        Thanks you

  2. #2
    Sencha - Support Team keckeroo's Avatar
    Join Date
    Mar 2008
    Location
    Winnipeg, Canada
    Posts
    387
    Answers
    12

    Default

    Looks like you have an extraneous ')' after your class name. Remove it and this should work

    Code:
    Ext.define('App.model.SearchResults', { 
    	extend:'Ext.data.Model',
    
    	fields: [
    		{ name: 'issue_id', type: 'int' },
    		{ name: 'issue_title', type: 'string' },
    		{ name: 'issue_date', type: 'string' },
    		{ name: 'number', type: 'int' },
    		{ name: 'count', type: 'int' }
    	]
    });

  3. #3
    Sencha User
    Join Date
    Oct 2012
    Posts
    13

    Default launch functions not called in Ext.app.Application

    App = new Ext.app.Application({
    tabletStartupScreen: 'images/loading-tablet.png',
    phoneStartupScreen: 'images/loading-tablet.png',
    icon: 'images/iconNew.png',
    tabletIcon: 'images/iconNew.png',
    phoneIcon: 'images/iconNew.png',
    glossOnIcon: true,
    name: "App",
    client_id: '_',
    lang: 'francais',
    issue_id: 138,
    pid: 138,


    getParameterByName: function(name) {
    var match = RegExp('[?&]' + name + '=([^&]*)')
    .exec(window.location.search);
    return match && decodeURIComponent(match[1].replace(/\+/g, ' '));
    },

    models: ['Viewer', 'SearchResults', 'Bookmarks'],
    controllers: ['Viewer', 'Pages', 'Chapters', 'Bookmarks'],
    views: ['Viewport', 'viewer.Index', 'viewer.Contact', 'viewer.Library', 'viewer.Pages', 'viewer.Search', 'viewer.SearchLibrary',
    'viewer.SearchKeyword', 'viewer.SearchKeywordDoc' , 'viewer.Share', 'viewer.Thumbnails', 'viewer.Bookmarks', 'viewer.BookmarksPop', 'viewer.Links', 'viewer.Help', 'viewer.Models'],
    stores: ['Viewer', 'Pages', 'SearchResults', 'Bookmarks'],


    launch: function() {
    Ext.create('App'); // v2
    alert('aa');
    console.log(App.getParameterByName('pid'));
    this.getController('App.controller.Viewer');
    }
    });


    The function getParameterByName can be used in models, but the alert or the console.log is not shown ...
    Infact I wanted to check if the controller Viewer.js is called/run with this line
    this.getController('App.controller.Viewer');

    Infact I was trying to replace the old code
    Ext.dispatch({
    controller: 'Viewer',
    action: 'viewPages',
    issue_id: App.getParameterByName('pid')
    });

    Thanks in advance, Bia

  4. #4
    Sencha User
    Join Date
    Oct 2012
    Posts
    13

    Default Thank you

    for your help

  5. #5
    Sencha User tobiu's Avatar
    Join Date
    May 2007
    Location
    Munich (Germany)
    Posts
    2,751
    Answers
    130

    Default

    please do not post sencha touch related questions inside the ext js forums, or no one will find them.

    take a look at this guide:
    http://docs.sencha.com/touch/2.2.1/#...upgrade_1_to_2

    you certainly don't want to use the new operator, create an instance of an application and create it again in its launch method.
    the guide points out how to do it right (just Ext.application()).
    Best regards
    Tobias Uhlig

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •