简体   繁体   English

sencha touch ListPaging插件“加载更多”按钮位置问题

[英]sencha touch ListPaging plugin “load more” button position issue

I'm facing an issue regarding the position of the Load More... button in sencha touch2 . 我在sencha touch2遇到有关“ 加载更多...”按钮的位置的问题。 Here, the Load More button is added using ListPaging plugin and from the Ext.plugins.Listpaging docs it states: 在这里,使用ListPaging插件添加了“加载更多”按钮,并从Ext.plugins.Listpaging文档中添加:

Adds a Load More button at the bottom of the list. 在列表底部添加“加载更多”按钮。 When the user presses this button, the next page of data will be loaded into the store and appended to the List. 当用户按下此按钮时,下一页数据将被加载到存储中并附加到列表中。

But, here, the list item with load more button appears at the top of the list, not to the bottom. 但是,在这里,带有更多加载的按钮的列表项显示在列表的顶部,而不是底部。 See my code here: 在这里查看我的代码:

Ext.define('MyApp.view.MyLIst', {
            extend : 'Ext.dataview.List',
            xtype : 'mylist',
            id : 'myList' ,
            requires : [Ext.data.Store','Ext.plugin.ListPaging'],

            config : {
                width : '100%',
                height : '100%',
                loadingText : 'Loading data...',
                emptyText : 'No Members',
                itemTpl : '<div class="mylisttitle">{title}</div>',
                store : 'mylistStore',
                plugins : [
                        {
                        xclass : 'Ext.plugin.ListPaging',
                        autoPaging : false,
                        loadNextPage: function() {
                                console.log('Load more button clicked');
                            // fire event here
                            }
                        }],
                masked : false,
                mode : 'SINGLE',
                scrollable : {
                    direction : 'vertical',
                    directionLock : true
                }
            }

        });

and see the result below: 并查看以下结果: 在此处输入图片说明

Any idea how could I show the same button at the bottom of the list? 知道如何在列表底部显示相同的按钮吗?

Thanks 谢谢

EDIT : I had posted the issue in senchatouch forum to, still awaiting a solution, you can see it here 编辑 :我已经在senchatouch论坛上发布了该问题,仍然在等待解决方案,您可以在这里看到它

Kind of strange. 有点奇怪。 Can you try removing these properties (width, height and scrollable) and adding "layout:fit" to the parent of this list. 您可以尝试删除这些属性(宽度,高度和可滚动属性),然后将“ layout:fit”添加到此列表的父级吗?

Solved it: 解决了:

I was missing this : infinite: true 我错过了这个: infinite: true

Load more button now appears at the bottom . 加载更多按钮现在显示在底部。

Thanks @blessenm for the working Demo :-) 感谢@blessenm的演示工作 :-)

If you have any custom css try disabling it. 如果您有任何自定义CSS,请尝试将其禁用。 Or if you are able to reproduce the same issue in a fiddle it would be more easier to fix. 或者,如果您能够在小提琴中重现相同的问题,则更容易解决。 Here is a work demo jsfiddle.net/blessenm/9ypwk 这是一个工作演示jsfiddle.net/blessenm/9ypwk

Ext.application({
    launch: function () {
        Ext.define('TweetStore', {
            extend: 'Ext.data.Store',

            config: {


         fields: ['from_user', 'profile_image_url', 'text', 'created_at'],

            pageSize: 25,
            autoLoad: true,

            proxy: {
                type: 'jsonp',
                url: 'http://search.twitter.com/search.json',

                pageParam: 'page',
                limitParam: 'rpp',

                extraParams: {
                    q: 'sencha'
                },

                reader: {
                    type: 'json',
                    rootProperty: 'results'
                }
            }
        }
    });

    Ext.define('MyApp.list.List', {
        extend: 'Ext.List',

        config: {
            useSimpleItems: false,
            variableHeights: true,
            infinite: true,
            disableSelection: true,
            allowDeselect: false,
            store: Ext.create('TweetStore'),
            loadingText: 'Loading data...',
            emptyText: 'No Members',

            plugins: [{
                xclass: 'Ext.plugin.ListPaging',
                autoPaging: false
            }],

            itemTpl: Ext.create('Ext.XTemplate',
                '<div>{text}</div>'),
            masked: false,
            mode: 'SINGLE',
            scrollable: {
                direction: 'vertical',
                directionLock: true
            }
        }
    });

    Ext.define('MyApp.list.Container', {
        extend: 'Ext.Container',
        config: {
            fullscreen: true,
            layout: 'vbox',
            items: [{
                xtype: 'titlebar',
                title: 'Load More Plugin',
            }, {
                xclass: 'MyApp.list.List',
                flex: 1
            }]
        }
    });
    Ext.create('MyApp.list.Container');
}
});

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM