2011-09-08 25 views
0

我对此非常感兴趣,并且非常感谢任何提示。当我尝试加载我的“dealerList”店:分机存储没有正确加载数据

updateDealerList : function(){ 
    myapp.stores.dealerList.load(); 
} 

编辑:请不要介意,终于解开了它自己...店工作的时候停止使用协会

回答

0

的原因是你有配置不正确的事情。

您的DealerList模型被映射到currentPage,totalPages,经销商,但读者有一个经销商的根。你的方式有它设置了JSON应该是这样的:

{ 
    dealers : [ 
     { 
      currentPage : 0, 
      totalPages : 10, 
      dealers  : [....] 
     } 
    ] 
} 

但是,这是不是你想要的。从你的PHP文件中使用JSON,这是你的模型+商店应该是什么样子:

Ext.regModel('DealerList', { 
    fields : [ 
     'dealerName' 
    ] 
}); 

myapp.stores.dealerList = new Ext.data.Store({ 
    model : 'DealerList', 

    proxy : { 
     type: 'ajax', 
     url : 'dealerresults.php', 
     extraParams: { 
      app_id: '<?php echo $app_id; ?>', 
      arrayParam: ['value1', 'value2'] 
     }, 
     reader: { 
      type: 'json', 
      root: 'dealers', 
     } 
    } 
}); 

读者将整个JSON字符串和解析它。根据读者指定的根目录,这就是查找所需记录的位置,因此JSON中的“经销商”就是您的记录所在的位置。