1

Plz check the screen shot hereI am trying to add one paging toolbar in my existing toolbar and hide the first, previous, next, last and refresh button by using following code. My problem is that I am unable to fetch correct afterPageText value(total number of pages). I m doing this for resultlist in xCP Designer. Plz help.

CODE:

    
Ext.define('Override.toolbar.Paging', {
override: 'Ext.toolbar.Paging',
hideFirstButton: false,
hidePrevButton: false,
hideBeforePageText: false,
hidePageNumberField: false,
hideAfterPageText: false,
hideNextButton: false,
hideLastButton: false,
hideRefreshButton: false,   
getPagingItems: function() {
        var me = this;
        return [{
        itemId: 'first',
        tooltip: me.firstText,
        overflowText: me.firstText,
        iconCls: Ext.baseCSSPrefix + 'tbar-page-first',
        hidden: me.hideFirstButton,
        disabled: true,
        handler: me.moveFirst,
        scope: me
        }, {
        itemId: 'prev',
        tooltip: me.prevText,
        overflowText: me.prevText,
        iconCls: Ext.baseCSSPrefix + 'tbar-page-prev',
        hidden: me.hidePrevButton,
        disabled: true,
        handler: me.movePrevious,
        scope: me
        }, {
        xtype: 'tbseparator',
        hidden: me.hideFirstButton && me.hidePrevButton
        }, {
        xtype: 'tbtext',
        text: me.beforePageText,
        hidden: me.hideBeforePageText
        }, {
        xtype: 'numberfield',
        itemId: 'inputItem',
        name: 'inputItem',
        hidden: me.hidePageNumberField,
        cls: Ext.baseCSSPrefix + 'tbar-page-number',
        allowDecimals: false,
        minValue: 1,
        hideTrigger: true,
        enableKeyEvents: true,
        keyNavEnabled: false,
        selectOnFocus: true,
        submitValue: false,        
        isFormField: false,
        width: me.inputItemWidth,
        margins: '-1 2 3 2',
        listeners: {
        scope: me,
        keydown: me.onPagingKeyDown,
        blur: me.onPagingBlur
            }
        }, {
            xtype: 'tbtext',
            itemId: 'afterTextItem',
            hidden: me.hideAfterPageText,
            text: "of {0}"
        }, {
            xtype: 'tbseparator',
            hidden: me.hideNextButton && me.hideLastButton
        }, {
            itemId: 'next',
            tooltip: me.nextText,
            overflowText: me.nextText,
            iconCls: Ext.baseCSSPrefix + 'tbar-page-next',
            hidden: me.hideNextButton,
            disabled: true,
           handler: me.moveNext,
            scope: me
        }, {
            itemId: 'last',
            tooltip: me.lastText,
            overflowText: me.lastText,
            iconCls: Ext.baseCSSPrefix + 'tbar-page-last',
            hidden: me.hideLastButton,
            disabled: true,
            handler: me.moveLast,
            scope: me
        }, {
            xtype: 'tbseparator',
            hidden: me.hideRefreshButton
        }, {
            itemId: 'refresh',
            hidden: me.hideRefreshButton,
            tooltip: me.refreshText,
            overflowText: me.refreshText,
            iconCls: Ext.baseCSSPrefix + 'tbar-loading',
            handler: me.doRefresh,
            scope: me
        }];
    }
});
xcp.widget.grid.ResultsListGrid.override({
        initComponent: function () {
            var me = this;
            this.dockedItems = [
   {
                xtype: 'toolbar',
    //store: me.store,
                dock: 'bottom',
    height: '45px',
                items: [
                    //'->',//right alight the button
     {
                xtype: 'xcp_pagingtoolbar',
                store: me.store,
    //flex: true,
                dock: 'bottom',
                displayInfo: true
            },'->',
   {
   xtype: 'pagingtoolbar',
            store: me.store,
   displayInfo: false,
    hideRefreshButton: true,
                hideFirstButton: true,
                hideLastButton: true,
                hidePrevButton: true,
                hideNextButton: true,
    //disabled: true
   }
                    ]
            },    
   ];
            this.callParent();
        }
    }
);

Thanks. -SS

Shashank Shekhar
  • 43
  • 1
  • 1
  • 5

1 Answers1

0

Incorrect total number of pages, or any discrepancy in paging info, are almost always caused by an incorrect server response.

If we have configured pageSize:20 and we want page 2, server must return exactly 20 records, starting from record 21 (1 based numbering) and must return correct total number of records in the table.

Saki
  • 5,827
  • 2
  • 15
  • 15
  • yes Saki, I agree. plz suggest me solution to this problem – Shashank Shekhar Jan 12 '15 at 10:22
  • The server must honor the sent parameters `start` and `limit` and return only the matching records. I must also return the total number of records. Generally, it's a server side code problem. – Saki Jan 12 '15 at 10:26
  • I m new to ext js, can u plz suggest what changes should I make in my code? – Shashank Shekhar Jan 12 '15 at 11:39
  • Again, no change in the client side code posted above; server code is the culprit almost for sure. – Saki Jan 12 '15 at 11:42
  • you tell us. What data service are you using in your page form? – Miki Jan 12 '15 at 11:58
  • I think there is not any server side coding, everything being done on the client side(creation of store, creation of grid and all other things). – Shashank Shekhar Jan 12 '15 at 12:05
  • Post the store config. – Saki Jan 12 '15 at 12:07
  • I m doing it, Need one more help frm u: If I have defined my tempStore in another ext js file and If I want to access that tempStore over here, Is it possible? – Shashank Shekhar Jan 12 '15 at 12:36
  • And I am not configuring store over here. check the code, I have just declared the stroe equals to current grid store. – Shashank Shekhar Jan 12 '15 at 12:40
  • Store is a mandatory configuration option for grid. In other words, grid cannot work with a workable store so your store must be configured somewhere. If *you* have written the app you must have configured the store one way or another. – Saki Jan 12 '15 at 17:01
  • Saki is it possible to communicate with u via mail or chat, that way I will b able to explain u more clearly – Shashank Shekhar Jan 13 '15 at 12:02
  • I'm not the only one who could help you. You have better chances if you post your code here or, even better, in a runnable form at https://fiddle.sencha.com From there we can proceed. – Saki Jan 13 '15 at 12:14