1. #1
    Sencha User
    Join Date
    Jul 2011
    Posts
    19
    Vote Rating
    0
    jayapal is on a distinguished road

      0  

    Default Override GridPanel ID lose getView function?

    Override GridPanel ID lose getView function?


    Hi friends,

    I am using GridPanel in my application. When I tried to override ID, I am unable to use grid.getView() function.

    Here the code
    Before Override ID:
    var grid=Ext.getCmp("ext-comp-1001").getView(); // I can able to get the function
    After Override ID:
    var grid=Ext.getCmp("My_Grid_Panel").getView(); // I can't able to get the function
    ERROR: Ext.getCmp("My_Grid_Panel").getView is not a function

    How can I fix this issue?

    Thanks & Regards,
    Jayapal D

  2. #2
    Sencha - Community Support Team mankz's Avatar
    Join Date
    Nov 2007
    Location
    Stockholm, Sweden
    Posts
    2,735
    Vote Rating
    104
    mankz is a name known to all mankz is a name known to all mankz is a name known to all mankz is a name known to all mankz is a name known to all mankz is a name known to all

      0  

    Default


    What does 'override ID' mean? Are you setting an ID property? Should be 'id', case sensitive.

  3. #3
    Sencha User
    Join Date
    Jul 2011
    Posts
    19
    Vote Rating
    0
    jayapal is on a distinguished road

      0  

    Default override gridpanel autogenerated id

    override gridpanel autogenerated id


    Thanks for quick response

    My GridPanel Source code:
    MyPanel = Ext.extend(Ext.grid.GridPanel, {
    pageSize: 30,
    dataLoaded: false,
    stateful: true,
    stateId: "my_state_id_grid",
    id: "My_Grid_Panel",
    ----------------------
    -----------------------
    });

    I want to use getview function i.e.
    var grid=Ext.getCmp("My_Grid_Panel").getView(); // throws error
    If I didn't override the GridPanel id, then I can able to access getView() with the help of auto generated id. i.e.
    var grid=Ext.getCmp("ext-comp-1001").getView();

  4. #4
    Sencha - Community Support Team mankz's Avatar
    Join Date
    Nov 2007
    Location
    Stockholm, Sweden
    Posts
    2,735
    Vote Rating
    104
    mankz is a name known to all mankz is a name known to all mankz is a name known to all mankz is a name known to all mankz is a name known to all mankz is a name known to all

      0  

    Default


    You can't put the 'id' in your class definition. Id's belong on _instances_ of a class, not on the class itself.

  5. #5
    Sencha User
    Join Date
    Jul 2011
    Posts
    19
    Vote Rating
    0
    jayapal is on a distinguished road

      0  

    Default thanks for info

    thanks for info


    Then how can use my own id rather than auto generated id?

  6. #6
    Sencha - Community Support Team mankz's Avatar
    Join Date
    Nov 2007
    Location
    Stockholm, Sweden
    Posts
    2,735
    Vote Rating
    104
    mankz is a name known to all mankz is a name known to all mankz is a name known to all mankz is a name known to all mankz is a name known to all mankz is a name known to all

      0  

    Default


    When you create an instance of your class:

    Code:
    var yourPanel = new MyPanel({
        id : 'foo'
    });

  7. #7
    Sencha User
    Join Date
    Jul 2011
    Posts
    19
    Vote Rating
    0
    jayapal is on a distinguished road

      0  

    Default I tried that before itself, but same error. Here the code

    I tried that before itself, but same error. Here the code


    Code:
    var MyNewPanel = new MyPanel({
                                           id:'My_Grid_Panel',
                                           pageSize: 40
                                   });
    ERROR: Ext.getCmp("My_Grid_Panel").getView is not a function

  8. #8
    Sencha - Community Support Team mankz's Avatar
    Join Date
    Nov 2007
    Location
    Stockholm, Sweden
    Posts
    2,735
    Vote Rating
    104
    mankz is a name known to all mankz is a name known to all mankz is a name known to all mankz is a name known to all mankz is a name known to all mankz is a name known to all

      0  

    Default


    Did you remove 'id' from the class definition too? Post full code please.

  9. #9
    Sencha User
    Join Date
    Jul 2011
    Posts
    19
    Vote Rating
    0
    jayapal is on a distinguished road

      0  

    Default Code

    Code


    Code:
    MyPanel = Ext.extend(Ext.grid.GridPanel, {
      pageSize: 30,
        dataLoaded: false,
        stateful: true,
        stateId: "my_state_id_grid",
         initComponent: function() {
            Ext.QuickTips.init();
            Ext.apply(this, {
                store: {
                    xtype: 'jsonstore',
                    totalProperty: 'total',
                    proxy: new Ext.data.HttpProxy({
                        method: 'GET',
                        disableCaching: false,
                        url: '/xx/xx/xx'
                }),
                root: 'fields',
                fields: ['xxx']
                },
                colModel: new Ext.grid.ColumnModel([
                    {
                        header: 'xxx',
                        dataIndex: 'xxx',
                        width: 100,
                        sortable: true,
                        hidden: true
                    }
                ]),
                selModel: new Ext.grid.RowSelectionModel({
                    singleSelect: true
                }),
                iconCls: 'icon-grid',
                loadMask: true,
                autoScroll: true,
                viewConfig: {
                    forceFit: true
                }
            });
            this.plugins = [new Sleuth.filter.GridFilters({
                local: false,
                stateful: true,
                stateId: 'state_id_grid_filter',
                encode: true,
                filters: [
                    {type: 'string', dataIndex: 'xxx'},
                ],
            })];
            this.bbar = new Ext.PagingToolbar({
                    pageSize: this.pageSize,
                    stateId: 'my_id_pagin',
                    stateful: true,
                    store: this.store,
                    displayInfo: true,
                    plugins: this.plugins,
                    xtype: 'paging',
                stateEvents: ["change"],
    
                getState: function() {var state = Ext.state.Manager.getProvider();
                           state.set('startStore',this.store.lastOptions.params.start);
                           var grid=Ext.getCmp("ext-comp-1001").getView()
                           state.set('active_field',grid.grid.filters.keyTracker[0]);
                           return {pageSize: this.pageSize};
                           }
    
            });
            MyPanel.superclass.initComponent.apply(this, arguments);
            this.on({afterlayout: {single: true, fn:function() {  
                this.bottomToolbar.bindStore(this.store);
                var state = Ext.state.Manager.getProvider();
                var start = state.get('startStore',0)
                this.getStore().load({params: {start: start, limit: this.pageSize}});
                }
            }});
        }
    });
    
    
    var MyNewPanel = new MyPanel({id:'My_Grid_Panel',pageSize: 40});

  10. #10
    Sencha - Community Support Team mankz's Avatar
    Join Date
    Nov 2007
    Location
    Stockholm, Sweden
    Posts
    2,735
    Vote Rating
    104
    mankz is a name known to all mankz is a name known to all mankz is a name known to all mankz is a name known to all mankz is a name known to all mankz is a name known to all

      0  

    Default


    This looks like Ext 3 code, why are you posting in 4.x forums?

Thread Participants: 1

Tags for this Thread

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