Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3761018
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T10:33:39+00:00 2026-05-19T10:33:39+00:00

I novice in extJS. I have trouble with PagingToolbar and Store. When I click

  • 0

I novice in extJS.
I have trouble with PagingToolbar and Store. When I click to ‘next page’ PagingToolbar works correctly , but the gride don’t update. Why is this happening? Help me please.
This’s my code:
`

    getJsonReader: function(){
            this.JsonReader = new Ext.data.JsonReader({
                    totalProperty: 'results',
                    root: 'data',         
                    idProperty: 'id',     
                    fields: [                
                            {name:'id', type: 'int', allowBlank: false},
                            {name: 'firstName', allowBlank: false},
                            {name: 'lastName', allowBlank: false},
                            {name: 'middleName',allowBlank: false},
                            {name: 'fotoTeacher',allowBlank: false}
                    ]

            });
            return this.JsonReader;
    },

    getStore: function(){
            this.store = new Ext.data.Store({
                    id: 'store-teachers',
                    reader: this.getJsonReader(),
                    proxy: new Ext.data.HttpProxy({
                        method: 'POST',
                        url: 'admin/get_teachers'
                    }),

                    autoLoad: {params:{start:0, limit:3}},
                    listeners: {

                        load: function()
                        {

                            if(jQuery('#panel-editTeacherHtml').length)
                            {
                                //remove attention
                                jQuery('#panel-editTeacherHtml').remove();
                            }


                            Ext.getCmp('grid-editTeacher').show();
                        },
                        exception: function()
                        {
                            Ext.getCmp('grid-editTeacher').hide();

                            if(!document.getElementById('panel-editTeacherHtml'))
                            {
                                Ext.DomHelper.insertAfter('panel-editTeacher-refreshButton',{
                                    id: 'panel-editTeacherHtml',
                                    html:'Увы, но нет ни одного преподавателя =('
                                });
                            }
                        }
                    }
            });
            return this.store;
    },

    titleTeacherfoto: function(val)
    {
        return '<img src="'+val+'" />';
    },


    getGrid: function(){

            this.grid = new Ext.grid.GridPanel({
                 frame             : true,
                    autoHeight:true,
                    id:'grid-editTeacher',
                    loadMask: true,
                    store: this.getStore(),          
                    sm: new Ext.grid.CheckboxSelectionModel({
                       singleSelect: false,
                       checkOnly: true
                    }),
                    cm: new Ext.grid.ColumnModel({  
                                    {header: 'Фамилия', dataIndex: 'lastName'},
                                    {header: 'Имя', dataIndex: 'firstName', sortable: false},
                                    {header: 'Отчество', dataIndex: 'middleName', sortable: false},
                                    {header: 'Фотография', dataIndex: 'fotoTeacher', renderer: this.titleTeacherfoto}
                            ],

                            defaultSortable: true
                    }),

                    viewConfig: {
                            forceFit:true
                        },
                    bbar: new Ext.PagingToolbar({ 
                       id:'pager-editTeacher',
                       displayInfo: true,
                       displayMsg: 'Преподаватели {0} - {1} из {2}',
                       beforePageText: 'Страница',
                       afterPageText: 'из {0}',
                       prependButtons: true,
                       pageSize: 3,
                       store: this.getStore()
                    })
            })

            return this.grid;
    },

    getPanel: function(){

           return new Ext.Panel({
            frame: true,
            bodyStyle: 'padding:5px;',
            id: 'panel-editTeacher',
            autoScroll: true,
            title: 'Панель редактирования преподавателей',
            items: [{
                     xtype: 'button',
                     text: 'Обновить',
                     iconCls: 'refresh',
                     id:'panel-editTeacher-refreshButton',
                     style: 'margin-bottom:10px',
                     listeners:{
                         click: function(){

                            grid = Ext.getCmp('grid-editTeacher');
                            grid.getStore().reload();


                            Ext.getCmp('pager-editTeacher').doRefresh();


                         }
                     }
                    },
                    this.getGrid()
                    ]
        });
    }

Ajax responce

{success:true,
results:5,
data:[{"id":"1","firstName":"","lastName":"","middleName":"","fotoTeacher":"\/modules\/admin\/design\/img\/default\/teacher_thumb.jpg"},{"id":"2","firstName":"","lastName":"","middleName":"","fotoTeacher":"\/modules\/admin\/design\/img\/default\/teacher_thumb.jpg"},{"id":"3","firstName":"","lastName":"","middleName":"","fotoTeacher":"\/modules\/admin\/design\/img\/default\/teacher_thumb.jpg"}]}

P.s: Sorry for my english =)

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-19T10:33:40+00:00Added an answer on May 19, 2026 at 10:33 am

    I think your problem is that every time you click the button, a new store is created, and in the process a new Reader object.

    getStore: function(){
            this.store = new Ext.data.Store({
    ....
    

    So if you click the button, what happens is:

    grid.getStore().reload();
    //GridInstance.createANewStoreForMe(andCreateANewReaderForYourself).reload
    

    So, the newly created store fetches the exact same result as the original one.
    What you should be doing is creating the store in the objects namespace (this) during initialization, and not afterwards:

    MyApp.MyClass = Ext.extend(Ext.grid.Grid, {
    
    initComponent: function () {
    
            this.store = new Ext.data.Store({
                ...
            });
    
            // create config object
            var config = {
                store     : store,
                ...
            };
    
            // apply config
            Ext.apply(this, Ext.apply(this.initialConfig, config));
    
            // call parent
            MyApp.MyClass.superclass.initComponent.call(this);
    
        } // eo function initComponent
    
        ,getStore: function() {
            return this.store;
            // Or this.getStore(); in the case of this class (Grid which is always able to return it's own store)
        }
    
    }); // eo extend
    
    var myGrid = new MyApp.MyClass({});
    

    Good luck,
    Rob

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Novice question, but I don't really understand why there are so many operations for
Novice question I guess: The Scenario: I have an asp.net page that contains 6
Python novice here. I am using python2.7.2 on Windows7. I have installed the PyWin32
I am a JS novice so go easy on me here. But I wrote
Hi I am a novice in JAVA. I have been getting this file not
I'm a crappy novice programmer and have been struggling to get this working for
complete novice at work (who is also ill and feeling particularly thick) I have
im novice in XML and XSLT. i have a an xml file ( book.xml
I am a novice WPF programmer. My problem is as below. I have a
A novice R user here. So i have a data set formated like: Date

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.