Ext.NET icon indicating copy to clipboard operation
Ext.NET copied to clipboard

Ext.grid.filters.filter.List.getOptionsFromStore() issue with filtered stores

Open fabriciomurta opened this issue 5 years ago • 0 comments

Found: Ext.NET 5.1.0 Ext.NET forum thread: Grid filter missing items when page bar is on Sencha thread: (pending)

The Ext.grid.filters.filter.List.getOptionsFromStore() has a typo where it iterates thru the original store data although it fetches specific data to get the whole store while it is filtered.

This override should address the issue:

Ext.define('gh1693', {
    override: 'Ext.grid.filters.filter.List',
    getOptionsFromStore: function (store) {
        var me = this,
            data = store.getData(),

            map = {},
            ret = [],
            dataIndex = me.dataIndex,
            labelIndex = me.labelIndex,
            recData, idValue, labelValue;
        if (store.isFiltered() && !store.remoteFilter) {
            data = data.getSource();
        }

        data.each(function (record) {
            recData = record.data;
            idValue = recData[dataIndex];
            labelValue = recData[labelIndex];
            if (labelValue === undefined) {
                labelValue = idValue;
            }

            if (!map[idValue]) {
                map[idValue] = 1;
                ret.push([
                    idValue,
                    labelValue
                ]);
            }
        }, null, {
            filtered: true,

            collapsed: true
        });

        return ret;
    }
});

fabriciomurta avatar Feb 14 '20 00:02 fabriciomurta