2

ExtJS infinite grid我已经用这个例子做了一个应用程序。

我的应用程序从数据库接收数据。

它与少量行(100000)完美配合。

但是现在一个数据库包含一百万行。我观察到一个奇怪的效果:数据没有完全加载。每次网格显示不同的行数(最大 859176)。但我需要从数据库中加载所有行。

有谁知道如何解决这个问题?

我的代码:

Ext.require ([
    'Ext.grid.*',
    'Ext.data.*',
    'Ext.util.*',
    'Ext.grid.plugin.BufferedRenderer'
]);

Ext.onReady(function () {

    Ext.define('DoctorsList', {
        extend: 'Ext.data.Model',
        fields: [
            'id', 'fio', 'specialization', 'photo'
        ],
        idProperty: 'id'
    });

    var store = Ext.create('Ext.data.Store', {
        id: 'store',
        model: 'DoctorsList',
        buffered: true,
        pageSize: 100,
        proxy: {
            type: 'ajax',
            url: 'get_doctors.jsp',
            reader: {
                root: 'data',
                totalProperty: 'total'
            }
        },
        autoLoad: true
    });

    Ext.create('Ext.grid.Panel', {
        height: 600,
        title: 'Doctor\'s list',
        collapsible: true,
        store: store,
        columns: [
        {
            text: 'ID',
            dataIndex: 'id',
            width: 50,
            sortable: true
        },
        {
            text: 'Full name',
            dataIndex: 'fio',
            width: 300,
            sortable: true
        },
        {
            text: 'Specialization',
            dataIndex: 'specialization',
            width: 150,
            sortable: true
        },
        {
            text: 'Photo',
            dataIndex: 'photo',
            width: 100,
            sortable: false,
            renderer: function(value) {
                return '<img width="100" src="images/' + value + '" />';
            }
        }
        ],
        renderTo: 'doctors-list'
    });

});

添加:

在这里,您可以看到对 get_doctors.jsp 的最后请求和响应。您可以注意到,“总计”字段的编号为 1005000,但最后一行的 ID 为 423165。是 MS SQL 数据库选择屏幕。您可以在那里看到已使用的表总共有 1005000 行。

补充 2:这个 bug 出现在 Firefox 和 IE8 中,但它没有出现在 Opera、Google Chrome 和 Safari 中。

谢谢!

4

0 回答 0