[CLOSED] Prevent paging toolbar from calling doLoad using beforechange and returning false

Page 2 of 2 FirstFirst 12
  1. #11
    Quote Originally Posted by Daniil View Post
    Hi,

    First of all, thank you for the sample to reproduce.

    Well, we would prefer to leave the things as they are. Here is a related discussion on Sencha:
    http://www.sencha.com/forum/showthread.php?82196

    I would agree with @Evan to do not consider it a bug.
    Ok, I see his point and agree that its not a bug. But it's also not completely desired behavior. Like he said, it should be up to the developer and I would add that the developer should be able to reset the page count manually on the client side without having to set start and limit to 0 and make a request to the server just to have the page count updated. The store is empty.. it should be considered if no data was loaded from the server at all; for example: first page load with autoload=false on the store and requiring an action before the store populates. it's like me just saying "RESET to defaults" like clearing a form.
  2. #12
    You can use the scripts suggested by @Baidaly.

    Or just this trick after a removeAll call.
    PagingToolbar1.store.totalLength = 0;
    PagingToolbar1.onLoad(null, null, { params: { start: 0 }});
  3. #13
    I did a little bit of both:
    Ext.ux.PageResetPlugin = function (config) {
        Ext.apply(this, config);
    }
    
    
    Ext.extend(Ext.ux.PageResetPlugin, Ext.PagingToolbar, {
        init: function (tb) {
            Ext.apply(tb, {
                onClear: function (s, r) {
                    this.onLoad(s, r, s.lastOptions.params);
                },
                initResetEvents: function () {
                    this.store.un('clear', this.onClear, this);
                    this.store.on('clear', this.onClear, this);
                },
                getPageData: function () {
                    var total = this.store.getCount() > 0 ? this.store.getTotalCount() : 0;
                    return {
                        total: total,
                        activePage: Math.ceil((this.cursor + this.pageSize) / this.pageSize),
                        pages: total < this.pageSize ? 1 : Math.ceil(total / this.pageSize)
                    };
                }
            });
            tb.initResetEvents();
        }
    });
    
    
    Ext.preg('pageResetPlugin', Ext.ux.PageResetPlugin);
    Please advise if you think anything here might be problematic.
  4. #14
    Well, if you won't need to use a bindStore method, then, I think, your solution should work well.

    Could you clarify why you "un" a clear listener before "on"?
  5. #15
    Quote Originally Posted by Daniil View Post
    Well, if you won't need to use a bindStore method, then, I think, your solution should work well.

    Could you clarify why you "un" a clear listener before "on"?
    Oops.. that was not intentional. Thanks for catching that :)
  6. #16
    No problem:)

    Can we mark the thread closed?
  7. #17
    Quote Originally Posted by Daniil View Post
    No problem:)

    Can we mark the thread closed?
    Yes. Thanks for the assistance :D
Page 2 of 2 FirstFirst 12

Similar Threads

  1. Replies: 3
    Last Post: Jul 01, 2013, 6:24 AM
  2. Replies: 2
    Last Post: Dec 13, 2012, 4:43 AM
  3. Replies: 11
    Last Post: Jun 13, 2012, 4:53 PM
  4. [CLOSED] How to prevent focus loss after calling store.reload()
    By webclouder in forum 1.x Legacy Premium Help
    Replies: 10
    Last Post: Jun 20, 2011, 9:21 PM
  5. [CLOSED] grid.getRowsValues(false) is returning all rows
    By LeeTheGreek in forum 1.x Legacy Premium Help
    Replies: 4
    Last Post: Jan 26, 2010, 12:20 PM

Tags for this Thread

Posting Permissions