0

我在 2 个单独的选项卡中有两个列表,都连接到服务器端数据库。我正在尝试设置列表分页,并在其中一个列表上完全按照应有的方式运行。对于另一个列表,模型和商店具有与正确分页的列表相同的所有设置,但没有“加载更多...”文本显示在此列表的底部。

关于列表分页插件,两个列表基本上完全相同(即商店、模型、“列表”视图),但其中一个列表不起作用。有谁知道可能是什么原因造成的?

编辑更多信息:

我正在使用 Chrome 进行开发。看着网络,我似乎得到了看起来正确的 JSON,对于那个不工作的它返回 8 条记录,返回的总属性是 13(这是有道理的,因为我的页面大小设置为 8)。

列表中的商店不起作用

    Ext.define("IdeaBank.store.SharedProblems", {
extend: "Ext.data.Store",
required: "IdeaBank.model.SharedProblem",
config: {
    model: "IdeaBank.model.SharedProblem",
    clearOnPageLoad: false,
    pageSize: 8,
    proxy: {
        type: 'ajax',
        api: {
            create:      "http://mywebsite.com/submitProblem.php?action=create",
            read: "http://mywebsite.com/submitProblem.php?action=read",
            update: "http://mywebsite.com/submitProblem.php?action=update",
            destroy: "http://mywebsite.com/submitProblem.php?action=delete",
        },
        reader: {
            type: 'json',
            rootProperty: "problems",
            totalProperty: "total",
        }
    },
    autoLoad: true
}
 });

确实有效的列表中的商店

Ext.define("IdeaBank.store.SharedSolutions", {
extend: "Ext.data.Store",
required: "IdeaBank.model.SharedSolution",
config: {
    model: "IdeaBank.model.SharedSolution",
    clearOnPageLoad: false,
    proxy: {
        type: 'ajax',
        api: {
            create: "http://mywebsite.com/submitSolution.php?action=create",
            read: "http://mywebsite.com/submitSolution.php?action=read",
            update: "http://mywebsite.com/submitSolution.php?action=update",
            destroy: "http://mywebsite.com/submitSolution.php?action=delete",
        },
        reader: {
            type: 'json',
            rootProperty: "solutions",
            totalProperty: "total",
        }
    },
    pageSize: 8,
    autoLoad: true
}
});

来自不起作用的列表视图

Ext.define("IdeaBank.view.SharedProblemsList", {
extend: 'Ext.dataview.List',
alias: 'widget.sharedproblemslist',
requires: ['Ext.plugin.ListPaging'],
config: {
    autoLoad: true,
    plugins: [
        {
            xclass: 'Ext.plugin.ListPaging',
            autoPaging: true

        }
    ],
    loadingText: "Loading...",
    emptyText: [
                "</pre><div class='notes-list-empty-text'  style = 'padding: 2em;'>",
                "<p>There are no problems listed for the category you have selected.</p>",
                "</div><pre>"
                ].join(""),
    onItemDisclosure: true,
    itemTpl: [
            "</pre>",
                "<div class = 'list-item-title'><span style = 'margin-right: 5px; color: #25E014; font-size: 0.7em;'>{rating}</span> {problem}</div>",
            "<pre>"
            ].join(""),
}

});

来自有效的列表视图

Ext.define("IdeaBank.view.SharedSolutionsList", {
extend: 'Ext.dataview.List',
alias: 'widget.sharedsolutionslist',
requires: ['Ext.plugin.ListPaging'],
config: {
    autoLoad: true,
    plugins: [
        {
            xclass: 'Ext.plugin.ListPaging',
            autoPaging: true
        }
    ],
    loadingText: "Loading...",
    emptyText: [
                "</pre><div class='notes-list-empty-text'  style = 'padding: 2em;'>",
                "<p>There are no published solutions for the category you have selected.<p>",
                "</div><pre>"
                ].join(""),
    onItemDisclosure: true,
    itemTpl: [
            "</pre>",
                "<div class = 'list-item-title'><span style = 'margin-right: 5px; color: #25E014; font-size: 0.7em;'>{rating}</span> {title}</div>",
            "<pre>"
            ].join(""),
}

});
4

1 回答 1

0

确保在服务器端代码中实现分页逻辑。您必须提供逐页发送的功能。也许“submitSolution.php”没有部分发送数据。

于 2012-11-15T12:07:15.170 回答