Gelmiş geçmiş en büyük porno sitemiz olan 2pe de her zaman en kaliteli pornoları sunmayı hedefledik. Diğer video sitemiz olan vuam da ise hd porno ağırlıklı çalışmalara başladık.

  1. #1
    Sencha User
    Join Date
    Sep 2009
    Posts
    27
    Vote Rating
    1
    Joel is on a distinguished road

      0  

    Default Only show Paging Toolbar when appropriate

    Only show Paging Toolbar when appropriate


    Not sure if anyone is having the same problem but when using the Ext.plugins.ListPagingPlugin if you return a result set less than the page size the 'Load more...' still shows. Conversely, when you hit the last page the 'Load more...' doesn't disappear. The following override hides the paging plugin when not needed:

    Code:
    Ext.override(Ext.plugins.ListPagingPlugin, {
        onListUpdate : function() {
            if (this.list.store && this.list.store.data.length < (this.list.store.currentPage * this.list.store.pageSize)) {
                if (!this.rendered) {
                    return false;
                } else if (!this.autoPaging) {
                    this.el.removeCls('x-loading');
                    this.el.remove();
                } else {
                    this.loading = false;
                }
                return false;
            }
        
            if (!this.rendered) {
                this.render();
            }
    
            this.el.appendTo(this.list.getTargetEl());
            if (!this.autoPaging) {
                this.el.removeCls('x-loading');
            }
            this.loading = false;
        }
    });

  2. #2
    Sencha User
    Join Date
    Aug 2010
    Posts
    12
    Vote Rating
    0
    tucolino is on a distinguished road

      0  

    Default


    Thanks for this. Works well for me. Have you added a bug report?

  3. #3
    Sencha User
    Join Date
    Nov 2010
    Posts
    23
    Vote Rating
    0
    bwg is on a distinguished road

      0  

    Thumbs up


    Worked for me as well. Definitely file a bug report with this as a patch. I'd like to nominate this post for a sticky.

    My only gripe is that on the edge case where the total number of records is a multiple of the number of pages times the page size, the loading element appears one extra time because the app doesn't know yet that the server is at the end of the table.

  4. #4
    Sencha User
    Join Date
    Sep 2009
    Posts
    27
    Vote Rating
    1
    Joel is on a distinguished road

      0  

    Default


    Thanks, I've submitted a bug report (here). To fix the edge case (good find!) change the < to <=

  5. #5
    Sencha User Hanni Sullivan's Avatar
    Join Date
    May 2011
    Location
    Constance, Germany
    Posts
    84
    Vote Rating
    4
    Hanni Sullivan is on a distinguished road

      0  

    Default


    @bwg & joel: Thanks! The edge case situation gave me some trouble.

  6. #6
    Sencha User
    Join Date
    May 2007
    Posts
    5
    Vote Rating
    0
    zhiivn is on a distinguished road

      0  

    Default


    I want to update the code a little bit. It will prevent the list store from calling nextPage() if the result less than the page size .

    Code:
    Ext.override(Ext.plugins.ListPagingPlugin, {
        onListUpdate : function() {
            if (this.list.store && this.list.store.data.length < (this.list.store.currentPage * this.list.store.pageSize)) {
                if (!this.rendered) {
                    return false;
                } else if (!this.autoPaging) {
                    this.el.removeCls('x-loading');
                    this.el.remove();
                } else {
                    this.loading = false;
                }
                return false;
            }
        
            if (!this.rendered) {
                this.render();
            }
    
    
            this.el.appendTo(this.list.getTargetEl());
            if (!this.autoPaging) {
                this.el.removeCls('x-loading');
            }
            this.loading = false;
        },
        
        onScrollEnd : function(scroller, pos) {
            if (this.list.store && this.list.store.data.length < (this.list.store.currentPage * this.list.store.pageSize)) {
                return false;
            }
    
    
            if (pos.y >= Math.abs(scroller.offsetBoundary.top)) {
                this.loading = true;
                this.list.store.nextPage();
            }
        }    
    });

  7. #7
    Sencha User
    Join Date
    Jan 2009
    Posts
    3
    Vote Rating
    0
    flyingto is on a distinguished road

      0  

    Default


    thanks,it is very useful to me.

  8. #8
    Sencha User
    Join Date
    Aug 2011
    Posts
    62
    Vote Rating
    0
    slmd is on a distinguished road

      0  

    Default


    Hi,

    I need help with this code. First, my whole json elements are returned plus a load more link at the bottom. Then, depending on the defined pagesize and my json length, when i click a certain number of time on the load more link it disapears wich i think is normal.
    Can you help me show the correct numbers of elements that i define in the pageSize property please?

    Here the code
    Code:
    {
        "profile": [{
            "firstname": "firstname1",
            "lastname": "lastname1",
            "age": "1"
        },{
            "firstname": "firstname2",
            "lastname": "lastname2",
            "age": "2"
        },{
            "firstname": "firstname3",
            "lastname": "lastname3",
            "age": "3"
        }]
    }
    Code:
    Ext.setup({
    
    
        onReady : function() {
    
    
            var jsonLink = 'http://127.0.0.1/Appsfan-v2/data.json';
            var TPL = "{firstname} {lastname}";
    
    
            Ext.override(Ext.plugins.ListPagingPlugin, {
    
    
                onListUpdate : function() {
                    if(this.list.store && this.list.store.data.length < (this.list.store.currentPage * this.list.store.pageSize)) {
                        console.log(this.list.store.pageSize)
                        if(!this.rendered) {
                            return false;
                        } else if(!this.autoPaging) {
                            this.el.removeCls('x-loading');
                            this.el.remove();
                        } else {
                            this.loading = false;
                        }
    
    
                        return false;
                    }
    
    
                    if(!this.rendered) {
                        this.render();
                    }
    
    
                    this.el.appendTo(this.list.getTargetEl());
                    if(!this.autoPaging) {
                        this.el.removeCls('x-loading');
                    }
                    this.loading = false;
                },
                onScrollEnd : function(scroller, pos) {
                    if(this.list.store && this.list.store.data.length < (this.list.store.currentPage * this.list.store.pageSize)) {
                        return false;
                    }
    
    
                    if(pos.y >= Math.abs(scroller.offsetBoundary.top)) {
                        this.loading = true;
                        this.list.store.nextPage();
                    }
                }
            });
            
            var paging = new Ext.plugins.ListPagingPlugin({
                autoPaging: false,
                loadMoreText: "More...",
                pullRefreshText: "MAJ",
            })
    
    
            Ext.regModel('Profile', {
                fields : [{
                    name : 'firstname',
                    type : 'string'
                }, {
                    name : 'lastname',
                    type : 'string'
                }, {
                    name : 'age',
                    type : 'number'
                }]
            });
    
    
            var profileStore = new Ext.data.Store({
                model : 'Profile',
                remoteFilter: true,
                pageSize: 1,
                proxy : {
                    type : 'ajax',
                    url : jsonLink,
                    reader : {
                        type : 'tree',
                        root : 'profile'
                    }
                },
                autoLoad : true,
            });
            //console.log(profileStore);
    
    
            var myList = new Ext.List({
                itemTpl : TPL,
                store : profileStore,
                plugins : [paging]
            });
    
    
            new Ext.Panel({
                layout : 'card',
                fullscreen : true,
                items : [myList]
            });
        }
    })

Similar Threads

  1. Updating image on toolbar button and paging toolbar issues
    By Jangla in forum Ext 2.x: Help & Discussion
    Replies: 1
    Last Post: 9 Jul 2009, 1:21 AM
  2. Extjs paging toolbar for php paging
    By speedytangent in forum Ext 2.x: Help & Discussion
    Replies: 1
    Last Post: 29 Mar 2009, 2:14 PM
  3. Paging Toolbar Button (Show Details) issue
    By 828 in forum Ext 2.x: Help & Discussion
    Replies: 5
    Last Post: 13 Mar 2009, 11:57 AM
  4. Replies: 3
    Last Post: 15 Feb 2009, 4:54 PM
  5. Show paging grid in new window without paging for print
    By extjs newbie in forum Ext 2.x: Help & Discussion
    Replies: 1
    Last Post: 6 Aug 2008, 5:32 AM

Thread Participants: 6