Javascript-форум (https://javascript.ru/forum/)
-   ExtJS (https://javascript.ru/forum/extjs/)
-   -   store collect (https://javascript.ru/forum/extjs/31320-store-collect.html)

Eugent 03.09.2012 14:32

store collect
 
Привет

подскажите такой небольшой вопрос -
у store есть метод collect для выборки уникальных значений этого поля. Ищет ли этот метод в удаленных(не закомиченных) записях?

Ex_Soft 03.09.2012 18:00

Цитата:

Сообщение от http://docs.sencha.com/ext-js/4-1/source/Store.html#Ext-data-Store-method-collect
collect: function(dataIndex, allowNull, bypassFilter) {
        var me = this,
            *!*data*/!* = (bypassFilter === true && me.snapshot) ? me.snapshot : me.*!*data*/!*;

        return data.collect(dataIndex, 'data', allowNull);
    },

Удаленные же записи сидят в removed:
Цитата:

Сообщение от http://docs.sencha.com/ext-js/4-1/source/Store.html#Ext-data-Store-method-remove
remove: function(records, /* private */ isMove) {
        if (!Ext.isArray(records)) {
            records = [records];
        }

        /*
         * Pass the isMove parameter if we know we're going to be re-inserting this record
         */
        isMove = isMove === true;
        var me = this,
            sync = false,
            i = 0,
            length = records.length,
            isNotPhantom,
            index,
            record;

        for (; i < length; i++) {
            record = records[i];
            index = me.data.indexOf(record);

            if (me.snapshot) {
                me.snapshot.remove(record);
            }

            if (index > -1) {
                isNotPhantom = record.phantom !== true;

                // don't push phantom records onto removed
                if (!isMove && isNotPhantom) {

                    // Store the index the record was removed from so that rejectChanges can re-insert at the correct place.
                    // The record's index property won't do, as that is the index in the overall dataset when Store is buffered.
                    record.removedFrom = index;
                    me.*!*removed*/!*.push(record);
                }

                record.unjoin(me);
                me.data.remove(record);
                sync = sync || isNotPhantom;

                me.fireEvent('remove', me, record, index);
            }
        }

        me.fireEvent('datachanged', me);
        if (!isMove && me.autoSync && sync && !me.autoSyncSuspended) {
            me.sync();
        }
    },



Часовой пояс GMT +3, время: 12:59.