Javascript 迭代ExtJS存储中的记录并对特定字段进行过滤

Javascript 迭代ExtJS存储中的记录并对特定字段进行过滤,javascript,arrays,extjs,Javascript,Arrays,Extjs,我在一家商店里反复浏览记录,因为它们是这样进来的: Ext.create('Ext.data.Store', { model: 'Message', storeId: 'Staging', proxy: { type: 'memory', reader: { type: 'json' } }, listeners: { add: function(store, reco

我在一家商店里反复浏览记录,因为它们是这样进来的:

Ext.create('Ext.data.Store', {
    model: 'Message',
    storeId: 'Staging',
    proxy: {
        type: 'memory',
        reader: {
            type: 'json'
        }
    },
    listeners: {
        add: function(store, records, index, eOpts){
            if (!Ext.data.StoreManager.lookup('Historical').isLoading()) {

                this.each(function(item, index, count) {
                    if(item.notificationType === 'INBOX'){
                        // populate inbox store
                        // increment the unread inbox count
                        console.log('inbox');
                    } else if (item.notificationType === 'NOTIFICATION') {
                        // populate notifications store
                        // increment the unread notification count
                    }
                });

                // no historical data should be held in memory for performance
                this.removeAll();

            }  
        }
    }   
}); 
item.notificationType属性返回undefined

我尝试了其他属性,但它们也返回未定义的

我需要执行不同的行动时,不同的类型遇到,并认为这将做到这一点

因此,该项是存储中的一条记录,其结构中包含json,如下所示:

   {
      "source":"2",
      "target":"1416529",
      "sourceType":"USER",
      "redirectUrl":null,
      "message":"cow's go...",
      "id":606,
      "targetType":"TEAM",
      "messageType":"TIBRR_WALL_MESSAGE",
      "notificationType":"INBOX",
      "sentDate":1356599137173,
      "parameters":null,
      "targetId":"1416529",
      "sourceId":"2",
      "dispatched":true,
      "read":false,
      "readDate":null,
      "dispatchedDate":1356599137377
   }

您尚未发布模型定义,因此我假设您的模型中有一个名为“notificationType”的字段

在这种情况下,您需要使用get方法:

item.get('notificationType');

您的
项目中是否有
通知类型
?实际上,什么是
项目
?根据文档,项目是存储中的记录