1. #1
    Sencha User
    Join Date
    Nov 2012
    Location
    Geneva - Switzerland
    Posts
    3
    Vote Rating
    0
    SkunkP is on a distinguished road

      0  

    Default Answered: TypeError: Object [object Object] has no method 'getItemId'

    Answered: TypeError: Object [object Object] has no method 'getItemId'


    Hello, I am quite new to ExtJS and actually trying to modify/adapt the MVC webdesktop by Andreas https://github.com/derAndreas/Webdesktop

    I want to follow a hierarchy like this
    Viewport.js
    ¦---Desktop.js
    ¦------Topbar.js
    ¦----------...
    ¦------Bottombar.js
    ¦----------...
    ¦---Other.js
    I am stuck on this getItemId error since several hours so I am looking for help
    Here are some code examples

    app.js
    HTML Code:
    Ext.Loader.setConfig({
        enabled: true,
        paths: 'Ext.ux': 'path/to/ext4/examples/ux'
        }
    });
    
    Ext.application({
        name: 'MyApp',
        appFolder: 'app',
        autoCreateViewport: true,
    
        controllers: [
            'MyApp.controller.desktop.Desktop'
        ],
    
        views: [
            'MyApp.view.Viewport'
        ]
    });
    view.Viewport.js
    HTML Code:
    Ext.define('MyApp.view.Viewport', {
        extend: 'Ext.container.Viewport',
        requires: [
            'MyApp.view.desktop.Desktop'
        ],
    
        initComponent: function() {
            var me = this;
    
            Ext.apply(me, {
                layout: 'fit',
                items: {
                    xtype: 'myappdesktop'
                }
            });
            me.callParent();
        }
    });
    view.desktop.Desktop.js
    HTML Code:
    Ext.define('MyApp.view.desktop.Desktop', {
        extend: 'Ext.panel.Panel',
        alias: 'widget.myappdesktop',
        
        initComponent: function() {
            
            /*Various items using xtype + alias */
        } 
    });
    The controller is actually only there to have the views array [ 'MyApp.view.desktop.Desktop' ] to see if it does the trick, it does not...
    For now I only have several console.log in the views to check if things are working as I want.

    I think that the "TypeError: Object [object Object] has no method 'getItemId'" is linked to the Viewport.js when I try to use items : {xtype: 'alias'}

    Maybe the way I am working is completely wrong, any helps or inputs are welcome !

    Many thanks

  2. 1. Have you tried commenting out this in the viewport?
    Code:
    items: {    
        xtype: 'myappdesktop'
    }
    2. Are there any difference if you use this instead of the xtype?
    Code:
    Ext.create('MyApp.view.desktop.Desktop')
    3. How does the controller looks like?
    4. Is the app generated by sencha command?

  3. #2
    Sencha Premium Member EPV's Avatar
    Join Date
    Dec 2010
    Location
    Sweden
    Posts
    175
    Answers
    23
    Vote Rating
    13
    EPV will become famous soon enough

      0  

    Default


    1. Have you tried commenting out this in the viewport?
    Code:
    items: {    
        xtype: 'myappdesktop'
    }
    2. Are there any difference if you use this instead of the xtype?
    Code:
    Ext.create('MyApp.view.desktop.Desktop')
    3. How does the controller looks like?
    4. Is the app generated by sencha command?

  4. #3
    Sencha User
    Join Date
    Nov 2012
    Location
    Geneva - Switzerland
    Posts
    3
    Vote Rating
    0
    SkunkP is on a distinguished road

      0  

    Default


    Hello and thank you.

    1- Commenting out the item in the viewport makes the error disapear.

    2- Using Ext.create works, the Desktop.js is loaded and if I put a console.log in it the output is shown in the console.

    3- The controller looks like this
    Code:
    Ext.define('MyApp.controller.desktop.Desktop', {
        extend: 'Ext.app.Controller',
        
        views: [
            'desktop.Desktop'
        ]
    });
    
    
    Ext.onReady(function() {
        console.log('Desktop-controller loaded');
    });
    4- And no, the app is written in Netbeans

  5. #4
    Sencha Premium Member EPV's Avatar
    Join Date
    Dec 2010
    Location
    Sweden
    Posts
    175
    Answers
    23
    Vote Rating
    13
    EPV will become famous soon enough

      0  

    Default


    When writing the same code as you posted I can't get reproduce your error. Are the code in your post exactly the same as the code you're running?

    note: Because of you're "require" in the viewport you don't need the controller to load your desktop view.
    note: your Ext.loader code in app.js looks strange ...
    note: you have autoCreateViewport set to true so you don't need do define that in the views array.


    / E

  6. #5
    Sencha User
    Join Date
    Nov 2012
    Location
    Geneva - Switzerland
    Posts
    3
    Vote Rating
    0
    SkunkP is on a distinguished road

      0  

    Default


    Yes they are exactly the same but the app is named Coala instead of MyApp.

    I removed the desktop view in the controller, removed the viewport in the view array and went back to using
    Code:
    initComponent: function() {        
            var me = this;
            
            Ext.apply(me, {
                layout: 'fit',
                items: {
                    xtype: 'myappdesktop'
                }
            });
            me.callParent();
        }
    instead of Ext.create in the viewport, the error is back
    I may use a different approach (more or less what is explained in the MVC on the API docs) and use Ext.create if needed so that I can continue working on this project.

    But still I don't understand why I'm not able to call an alias xtype in that way.
    I will mark the topic as answered because Ext.create does the workaround but guys feel free to continue investigating.

    Thank you EPV

Thread Participants: 1

Turkiyenin en sevilen filmlerinin yer aldigi xnxx internet sitemiz olan ve porn sex tarzi bir site olan mobil porno izle sitemiz gercekten dillere destan bir durumda herkesin sevdigi bir site olarak tarihe gececege benziyor. Sitenin en belirgin ozelliklerinden birisi de Turkiyede gercekten kaliteli ve muntazam, duzenli porno izle siteleri olmamasidir. Bu yuzden iste. Ayrica en net goruntu kalitesine sahip adresinde yayinlanmaktadir. Mesela diğer sitelerimizden bahsedecek olursak, en iyi hd porno video arşivine sahip bir siteyiz. "The Best anal porn videos and slut anus, big asses movies set..." hd porno faketaxi