We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 2364
    • 73 Posts
    Hi, MODx.
    I have MODx.grid.Grid panel with context menu (edit, remove item), tbar (create item, refresh) and inline item editing. All working fine, but after adding new item (handler: this.createCategory) item is adding to db but any listener on quore-window-category-create (e.g. console.log(’ok’) or this.refresh()) produce JS error
    root is undefined

    Ext debug line
    var root = this.getRoot(o), c = root.length, totalRecords = c, success = true; 

    Used code:
    Quore.grid.Tagcategories = function(config) {
        config = config || {};
        Ext.applyIf(config,{
            id: 'quore-grid-tagcategories'
            ,url: Quore.config.connector_url
            ,autoDestroy: true
            ,baseParams: {action: 'mgr/tagcategories/getList'}
            ,fields: ['id','category_name','category_alias','menu']
            ,save_action: 'mgr/tagcategories/updateFromGrid'
            ,paging: true
            ,autosave: true
            ,remoteSort: true
            ,width: '95%'
            ,columns: [{
                header: 'ID'
                ,dataIndex: 'id'
                ,sortable: true
                ,width: 100
            },{
                header: 'Name'
                ,dataIndex: 'category_name'
                ,sortable: true
                ,width: 300
                ,editor: {xtype: 'textfield' ,allowBlank: true}
            },{
                header: 'Alias'
                ,dataIndex: 'category_alias'
                ,sortable: true
                ,width: 300
                ,editor: {xtype: 'textfield' ,allowBlank: true}
            }]
            ,tbar: [{
                text: 'Create Category'
                ,handler: this.createCategory
                ,scope: this
            },'-',{
                text: 'Refresh'
                ,handler: this.refresh
                ,scope: this
            }]
        });
        Quore.grid.Tagcategories.superclass.constructor.call(this,config)
    };
    Ext.extend(Quore.grid.Tagcategories,MODx.grid.Grid,{
        windows: {},
    //edit and remove handlers,
    
        createCategory: function(btn,e) {
            if (!this.windows.createCategory) {
                this.windows.createCategory = MODx.load({
                    xtype: 'quore-window-category-create'
                    ,listeners: {
                        'success': {fn: function() {
                                this.refresh();
                                //console.log('added');
                            }, scope: this
                        }
                    }
                });
            }
            this.windows.createCategory.show(e.target);
        }
    
    });
    Ext.reg('quore-grid-tagcategories',Quore.grid.Tagcategories);
    
    Quore.window.CreateCategory = function(config) {
        config = config || {};
        Ext.applyIf(config,{
            title: 'Create Category'
            ,id: 'quore-tag-category-create'
            ,height: 200
            ,width: 500
            ,url: Quore.config.connector_url
            ,action: 'mgr/tagcategories/create'
            ,fields: [{
                xtype: 'textfield'
                ,fieldLabel: 'Name'
                ,name: 'name'
                ,id: 'quore-tag-category-name'
                ,width: 300
                ,allowBlank: false
            },{
                xtype: 'textfield'
                ,fieldLabel: 'Alias'
                ,name: 'alias'
                ,id: 'quore-tag-category-alias'
                ,width: 300
                ,allowBlank: false
            }]
        });
        Quore.window.CreateCategory.superclass.constructor.call(this,config);
    };
    Ext.extend(Quore.window.CreateCategory,MODx.Window);
    Ext.reg('quore-window-category-create',Quore.window.CreateCategory);
    
    

    And like in this post message "Saving, please wait" do not disappearing.