1. #1
    Sencha User
    Join Date
    Nov 2011
    Posts
    15
    Vote Rating
    0
    4lenour is on a distinguished road

      0  

    Default Help Uncaught TypeError: Cannot read property 'buffered' of undefined on gridpanel

    Help Uncaught TypeError: Cannot read property 'buffered' of undefined on gridpanel


    Dear All

    i trying develop simple aplication using MVC Architecture using extjs 4.2, my problem is, if i call controller firt time it running but if i call same controller again i got the error "Uncaught TypeError: Cannot read property 'buffered' of undefined"

    please tell me the true way using store, grid on controller and this is my code

    i call dinamic controller from this code (please look at btnClicked:function(btn, e, eOpts))
    Code:
    Ext.define('IFO.controller.ifodashboard', {     
        extend: 'Ext.app.Controller',                 
        
        requires: [                 
            'Ext.Ajax'
        ],
        
        views: [
            'dashboard.viewheader',
            'dashboard.viewtoolbar',
            'dashboard.viewstatusbar',
            'dashboard.viewdashboard'
        ],
        
        init: function() {
            this.control({      
                'apptoolbar button[action=btnClicked]': {
                    click: this.btnClicked
                },
                'apptoolbar menu [action=btnClicked]': {
                    click: this.btnClicked
                }
            });
        },
        
        btnClicked:function(btn, e, eOpts){              
            if (btn.dataext.length<=0) return false;
            if (!btn.dataext.controller || !btn.dataext.xtype) return false;
            ifoViewPort.remove(Ext.getCmp('ifo-app-content'));  
            ifoApp.getController(btn.dataext.controller);      
            ifoViewPort.add({xtype:btn.dataext.xtype});   
        }        
        
    });
    and i call this controller
    Code:
    Ext.define('IFO.controller.system.iforoles', {     
        extend: 'Ext.app.Controller',                 
        
        requires: [                 
            'Ext.Ajax'
        ],
        
        views: [
            'system.v_panelroles',
            'system.viewgridroles',
            'system.viewtreegridmodules'
        ],      
        
        stores: [
            'system.storegridroles',
            'system.storetreegridmodules'  
        ],
        
        init: function() {
            this.control({     
                'viewgridroles button[action=addRecord]': {
                    click: this.addRecord
                }, 
                'viewgridroles' : {
                    rowSelected : this.rowSelected 
                }  
            });
        },
        
        addRecord:function(btn, e, eOpts){       
            var grid = btn.up('viewgridroles'); 
            grid.getStore().insert(0, Ext.create('INFOOKUS.model.system.modelgridroles'));   
        },
        
        rowSelected:function(grid, record, index, eOpts) {            
            var treeModStore = Ext.getCmp('id-viewtreegridmodules').getStore(); 
            treeModStore.getProxy().extraParams.role=record.get('id');
            treeModStore.getProxy().extraParams.flag='ROLE';
            treeModStore.load();       
        }
        
        
    });
    mydata store:
    Code:
    Ext.define('IFO.store.system.storegridroles', {
        extend:     'Ext.data.Store',         
        model:      'IFO.model.system.modelgridroles', 
        
        storeId: 'AdvSearchPost',
        autoDestroy :true,
        autoLoad:   true,
        autoSync:   true,
        remoteSort: true,         
        pageSize:   50, 
        
        requires: [                 
            'Ext.window.MessageBox'
        ], 
        
        proxy: {          
            type:   'ajax',        
            api: {                   
                read:       'roles',
                create:     'roles/add',
                destroy:    'roles/remove',
                update:     'roles/edit'
            },
            actionMethods: {
                create : 'POST',
                read   : 'POST',
                update : 'POST',
                destroy: 'POST'
            },
            writer: {
                type:   'json',
                method: 'POST',
                writeAllFields: false,
                writeRecordId : true,
                encode:         true,
                root:           'data',
                successProperty:    'success' 
            },
            reader: {
                type:               'json',
                root:               'data',
                idProperty:         'id',
                totalProperty:      'total',
                successProperty:    'success'
            },
            listeners: {
                exception: function (ajax, response, operation, eOpts) {  
                    switch(response.status)
                    {
                        case 401:
                            window.document.location.href=ifoBaseURL;    
                            return false;
                        break;
                        case 200:
                            var obj = Ext.JSON.decode(response.responseText);             
                            Ext.Msg.alert('Failure', obj.msg);     
                        break;
                        default:
                            Ext.Msg.alert(response.statusText, response.responseText);    
                    }                                                                 
                }
            }        
        },
        
        listeners : {
            write:function( store, operation, eOpts ) {    
                if (operation.action=='write') store.loadRecords( operation.records );      
            },
            load : function ( store, records, successful, eOpts ) {
                Ext.getCmp('id-viewgridroles').getSelectionModel().deselectAll(); 
                var treeModStore = Ext.getCmp('id-viewtreegridmodules').getStore(); 
                treeModStore.getProxy().extraParams.role=0;
                treeModStore.getProxy().extraParams.flag='ROLE';
                treeModStore.load();  
            }
        }
        
    });
    and my grid is
    Code:
    Ext.define('IFO.view.system.viewgridroles', {
        extend:     'Ext.grid.Panel',
        alias:      'widget.viewgridroles',
                                         
        title:      'Roles',
        id:         'id-viewgridroles', 
        autoShow:   true,
        autoScroll: true,      
        region:     'west',
        width:      '30%',
        split:      true,       
        store:      'system.storegridroles',
        
        initComponent: function() {   
            
            this.columns = [     
                {                    
                    xtype: 'checkcolumn',      
                    header: '<img src="images/icons/small/lamp.png"/>',           
                    dataIndex: 'publish',  
                    tooltip :'PUBLISH', 
                    hideable:false,
                    menuDisabled:true,
                    resizable:false,
                    sortable:false,
                    align:'center',  
                    width:50
                },         
                {
                    header: 'NAME', 
                    dataIndex: 'name',
                    flex: 1,
                    editor: {                                             
                        allowBlank: false,
                        maxLength :255
                    },
                    filterable: true,
                    filter: {
                        type: 'string'        
                    }
                },      
                {
                    header: 'NOTE', 
                    dataIndex: 'note',
                    flex: 1,
                    editor: {                                             
                        allowBlank: true,
                        maxLength :255
                    },
                    filterable: true,
                    filter: {
                        type: 'string'        
                    }
                },
                {
                  xtype:'actioncolumn',                           
                  width:50,  
                  align:'center',                                      
                  hideable : false,
                  menuDisabled : true,
                  sortable :false,
                  resizable :false,
                  items: [
                      {
                          align:'center',         
                          tooltip :'DELETE',           
                          getClass: function(v, meta, rec, rowIndex, colIndex) {
                                return "icon-delete";
                          },
                          handler: function(grid, rowIndex, colIndex) {        
                                grid.store.removeAt(rowIndex);    
                          }
                      }
                  ]
                }
            ];
            
            this.dockedItems = {
                xtype: 'pagingtoolbar',
                dock: 'bottom',
                store: 'system.storegridroles',
                displayMsg :'',
                emptyMsg :'',
                items: [
                    '-',
                    {
                        iconCls:'icon-plus',
                        text:'Add New',
                        action:'addRecord'
                    }
                ],
                displayInfo: true,
            };
            
            this.plugins= Ext.create('Ext.grid.plugin.RowEditing',{clicksToEdit: 2, clicksToMoveEditor: 1, errorSummary :false});
            
            this.features = new Ext.create('Ext.ux.grid.FiltersFeature', {
                encode: true, 
                local: false
            });
            
            this.callParent(arguments);        
            this.addEvents('rowSelected');
        },
        
        listeners :{
            select: function( grid, record, index, eOpts ) {
                this.fireEvent('rowSelected', grid, record, index, eOpts);
            }
        }
        
    });
    my menu is


    extjs.jpg
    please help me..

  2. #2
    Sencha User
    Join Date
    Nov 2011
    Posts
    15
    Vote Rating
    0
    4lenour is on a distinguished road

      0  

    Default


    any body can help me

  3. #3
    Sencha - Support Team slemmon's Avatar
    Join Date
    Mar 2009
    Location
    Boise, ID
    Posts
    4,781
    Vote Rating
    167
    slemmon is a splendid one to behold slemmon is a splendid one to behold slemmon is a splendid one to behold slemmon is a splendid one to behold slemmon is a splendid one to behold slemmon is a splendid one to behold slemmon is a splendid one to behold

      0  

    Default


    So, on the first button click the btnClicked method operates correctly and the second time the same button is clicked you get the error? Is that correct?

  4. #4
    Sencha User
    Join Date
    Nov 2011
    Posts
    15
    Vote Rating
    0
    4lenour is on a distinguished road

      0  

    Default


    yes, like u say slemmon

  5. #5
    Sencha Premium Member
    Join Date
    Apr 2011
    Posts
    52
    Vote Rating
    1
    rh_it is on a distinguished road

      0  

    Default Same error...

    Same error...


    Exactly I got the same error. I have a grid placed in a Window, when I click the button to open it works well, but If I close and retry to open it a second time doesn't work. The console log show this sibylline message:

    Uncaught TypeError: Cannot read property 'buffered' of undefined


    Any ideas?

  6. #6
    Sencha - Support Team slemmon's Avatar
    Join Date
    Mar 2009
    Location
    Boise, ID
    Posts
    4,781
    Vote Rating
    167
    slemmon is a splendid one to behold slemmon is a splendid one to behold slemmon is a splendid one to behold slemmon is a splendid one to behold slemmon is a splendid one to behold slemmon is a splendid one to behold slemmon is a splendid one to behold

      0  

    Default


    @4lenour,
    I'm afraid I'm not following where you're having trouble. What is happening on the first button click that is not happening on the second?

    @rh_it,
    What is the closeAction config set to on your window containing the grid?

  7. #7
    Sencha Premium Member
    Join Date
    Apr 2011
    Posts
    52
    Vote Rating
    1
    rh_it is on a distinguished road

      0  

    Default


    Hello, I set the
    Window closeAction as destroy
    FieldContainer (has no property like destroy)
    Grid closeAction as destroy.
    I tried to set all of them as hide but something broke up the layout. To call the Window I defined controller action on my Button as
    Code:
    Ext.create('MyPrj.view.MyWindow').show();

  8. #8
    Sencha - Support Team slemmon's Avatar
    Join Date
    Mar 2009
    Location
    Boise, ID
    Posts
    4,781
    Vote Rating
    167
    slemmon is a splendid one to behold slemmon is a splendid one to behold slemmon is a splendid one to behold slemmon is a splendid one to behold slemmon is a splendid one to behold slemmon is a splendid one to behold slemmon is a splendid one to behold

      0  

    Default


    closeAction on the window would need to be 'hide' if you want the window's child items not to be destroyed when the window is closed.

  9. #9
    Sencha User
    Join Date
    Nov 2011
    Posts
    15
    Vote Rating
    0
    4lenour is on a distinguished road

      0  

    Default


    i have the answer about this case, i am try to set false in autoDestroy or remove autoDestroy, and success!

Thread Participants: 2