Results 1 to 4 of 4

Thread: Migrating Extjs 4 to 6 classes

  1. #1
    Sencha User
    Join Date
    Apr 2012
    Posts
    7
    Answers
    1

    Default Answered: Migrating Extjs 4 to 6 classes

    We have js files writen in Extjs 4. I have to migrate these to Extjs 6. Almost everything is fine, but when we create own classes (extended extjs classes), we have a problem. (Unfortunately there's no mvc, just classes and create). In the ext-all-debug:

    PHP Code:
    create: function(configdefaultType) {
        if (
    typeof config === 'string') {
            return 
    Ext.widget(config);
        }
        if (
    config.isComponent) {
            return 
    config;
        }
        if (
    'xclass' in config) { // **config is true**
            
    return Ext.create(config.xclassconfig);
        }
        return 
    Ext.widget(config.xtype || defaultTypeconfig);
    }, 
    The config is true except an object, and we got the following error message in the console: "Cannot use 'in' operator to search for 'xclass' in true"

    eDyDI.jpg


    What is the problem with our classes or creating? What should I do?

    This is a class:

    PHP Code:
    Ext.define("My.component.TrunkListGrid", { 

        
    extend"My.component.Grid"

        
    // config

        
    initComponent: function () {

            
    // ...

            
    Ext.apply(this, {
                
    // ...          
            
    });

            
    this.callParent();

            
    this.addListener('render', function () {
                
    // ...
            
    }, this);

        }

    }); 
    This is a create:

    PHP Code:
    var Ext.create('My.component.TrunkListGrid', {
        
    // config
    }); 
    I think, I have to call something another way...

  2. Oah, I found it! I used the buttons: true in the config.

  3. #2
    Sencha Premium User evant's Avatar
    Join Date
    Apr 2007
    Location
    Sydney, Australia
    Posts
    19,254
    Answers
    759

    Default

    The stack trace is pointing to something to do with docked items, I'd suggest you put together a runnable test case.
    Twitter - @evantrimboli
    Former Sencha framework engineer, available for consulting.
    As of 2017-09-22 I am not employed by Sencha, all subsequent posts are my own and do not represent Sencha in any way.

  4. #3
    Sencha User
    Join Date
    Apr 2012
    Posts
    7
    Answers
    1

    Default

    If it builds itself, there will be a true after the paging toolbar.

    Untitled2_www.kepfeltoltes.hu_.jpg
    Here is the code of grid:

    PHP Code:
    Ext.define("My.component.Grid", { 

        
    extend'Ext.grid.Panel',
        
        
    // configs ...    n: true
        
    },
        
        
    initComponent: function () {
            
            
            
    // columns, fields, store ...

            // top toolbar
            
            
    var tbItems = [];
            if (
    this.buttons) {
                
    tbItems.push(
                    
    this.kapcsolgomb Ext.create('Ext.Button', {
                        
    icon'leftarrow16.png',
                        
    hiddentrue,
                        
    tooltip'Select',
                        
    handler: function () {
                            
    // ...
                        
    },
                        
    scopethis
                    
    })
                );
            }
            
            if (
    Ext.isDefined(this.customButtons)) {
                
    tbItems tbItems.concat(this.customButtons);
            }
            
            if (
    Ext.isDefined(this.excelExportFn)) {
                
    tbItems.push(
                    
    this.excelgomb Ext.create('Ext.Button', {
                        
    xtype'button',
                        
    tooltip'Export',
                        
    icon'excel16.gif',
                        
    handler: function (t) {
                            
    // ...
                        
    },
                        
    scopethis
                    
    })
                );
            }
            
            
    tbItems.push({xtype'tbfill'});
            if (
    this.filter) {
                
    tbItems.push(this.finder Ext.create('Ext.form.TextField', {
                    
    // filter field config
                
    }));
            }
            
            
    // grid
            
    Ext.apply(this, {
                
    forceFittrue,
                
    columns//...
                
    store//...
                
    bbarthis.paging this.pager Ext.create('Ext.PagingToolbar', {
                    
    storeExt.isDefined(this.store) ? this.store store,
                    
    displayInfotrue,
                    
    displayMsg'{1} / {2}',
                    
    emptyMsg""
                
    }) : undefined,
                
    tbarthis.showTbar ? {itemstbItems} : undefined,
                
    listenersExt.isDefined(this.listeners) ? this.listeners : {
                    
    render: function () {
                        
    this.getStore().load();
                    }
                }
            });
            
            
    this.callParent();
        },
       
        
    getButton: function (btn) {
            return 
    Ext.getClassName(this[btn]).indexOf("Button") > this[btn] : false;
        },
        
    setExtraParam: function (namevalue) {
            
    this.getStore().getProxy().extraParams[name] = value;
        },
        
    getSelectedRecord: function () {
            return 
    this.getView().getSelectionModel().getSelection()[0];
        }
    }); 

  5. #4
    Sencha User
    Join Date
    Apr 2012
    Posts
    7
    Answers
    1

    Default

    Oah, I found it! I used the buttons: true in the config.

Similar Threads

  1. Replies: 0
    Last Post: 23 Jul 2014, 3:25 PM
  2. Migrating extjs 2.3.0 to 4.x
    By freegenclik in forum Ext: Q&A
    Replies: 1
    Last Post: 26 Dec 2012, 12:14 PM

Tags for this Thread

Posting Permissions

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