1
votes

I have a large dataset (over 80k records). So I am trying to implement buffer but I couldn't get it work. If I include buffered configuration I am getting error object doesn't support this property. When I remove it, works ok but of course it takes forever to load the data.

Here is my code

Ext.Loader.setConfig({
    enabled: true,
    disableCaching: false
});

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

Ext.define('Borrower', {
    extend: 'Ext.data.Model',
    fields: [{
        name: 'Name',
        type: 'string'
    }, {
        name: 'Num',
        type:
            'string'
    }]
});

Ext.onReady(function () {

    var store = Ext.create('Ext.data.Store', {
        autoLoad: false,
        model: 'Borrower',
        pageSize: 100,
        buffered: true, // getting error object doestn support this property in extjs-all-debug.js
        proxy: {
            type: 'rest',
            url: 'borrBuff.xsp/byName',
            reader: {
                type: 'json',
                root: 'items'
            }
        }

    });

    var filters = {
        ftype: 'filters',
        encode: false,
        local: true
    };

    var grid = Ext.create('Ext.grid.Panel', {
        id: 'testgrid',
        store: store,
        features: [filters],
        plugins: 'bufferedrenderer',
        columns: [{
            text: 'Borr Name',
            dataIndex: 'Name',
            filterable: true
        }, {
            text: 'Number',
            dataIndex: 'Num'
        }]
    });

})

Opening the grid in a window on button click

var grid = Ext.getCmp('testgrid');
var win = Ext.create('Ext.Window', {
    title: 'Grid Filters Example',
    height: 400,
    width: 700,
    modal: true,
    layout: 'fit',
    items: grid
}).show();
grid.getStore().load();

Just couldnt figure out what I am doing wrong. Appreciate any help in fixing this issue.

1
Are you using ExtJS 4.2? - Darin Kolev
Yes. One more thing i noticed while trying to debug the error is on line filterBy(). If i remove filter, no longer see the error. But the buffer still doesnt work and i do need filter, thx. - lense

1 Answers

0
votes

Is there any reason to fetch all the data from server?

I'd recommend using data paging with all the pros, speed being the first one (and some cons too). If you choose to use an infinite grid, it will work well. In fact the basic idea behind infinite grid is fetching data in chunks (data paging in other words).

Filtering works without any problems with this scenario, see sample. It's usually handled by server, which is built to do this kind of tasks.