Extjs之遍历Store内的数据

Store作为数据的载体,通过下面的方法可以获得Store内的数据;

 1 Ext.define('haomlGeimjTongjGrid_store_data', {
 2     extend: 'Ext.data.Model',
 3     fields: ['id', 'jizcode', 'name', 'gaokgl', 'gaokdl', 'dikgl', 'dikdl', 'liezy', 'mein', 'hem']
 4 });
 5 var haomlGeimjTongjGrid_store = Ext.create('Ext.data.Store', {
 6     model: 'haomlGeimjTongjGrid_store_data',
 7     proxy: {
 8         url: '../haomglerq/getHaomlGeimjTongj',
 9         type: 'ajax',
10         reader: {
11             root: 'datas',
12             type: 'json'
13         }
14     }
15 });
16 var results = '[';
17 haomlGeimjTongjGrid_store.each(function(record){//get的名字要与Store绑定的Model的名字是一样的
18     var info = 'id:' + record.get('id') + ',jizcode:' + record.get('jizcode') + ',name:' + record.get('name') + 
19     ',gaokgl:' + record.get('gaokgl') + ',gaokdl:' + record.get('gaokdl') + ',dikgl:' + record.get('dikgl') + 
20     ',dikdl:' + record.get('dikdl') + ',liezy:' + record.get('liezy') + 
21     ',mein:' + record.get('mein') + ',hem:' + record.get('hem');
22     results = results + Ext.JSON.encode(info) + ',';
23 });
24 results = results + ']';

 

posted @ 2014-04-10 17:01  尐sんΙ頭  阅读(1686)  评论(0编辑  收藏  举报