2012-07-20 64 views
0

如何从已有的响应加载数据,以及如何读取已到达的响应并使用该响应数据在extjs中加载存储。我已在此发布我的回复。提前致谢。如何在没有指定url的情况下从响应加载存储

{"preparedSandData":[{"preparedsandId":57,"activeClay":1,"afs":1,"compactability":1,"date":"12-10-2012 12:00:00 AM","deadClay":1,"gcs":1,"loi":1,"moisture":1,"quantity":1,"shatterIndex":1,"shearStrength":1,"shift":"Morning","splittingStrength":1,"temperature":1,"time":"12-10-2012 12:00:00 AM","totalClay":1,"username":"manoj","sampleId":23},{"preparedsandId":58,"activeClay":2,"afs":2,"compactability":2,"date":"12-11-2012 12:00:00 AM","deadClay":2,"gcs":2,"loi":2,"moisture":2,"quantity":2,"shatterIndex":2,"shearStrength":2,"shift":"Morning","splittingStrength":2,"temperature":2,"time":"12-11-2012 12:00:00 AM","totalClay":2,"username":"manoj","sampleId":23},{"preparedsandId":59,"activeClay":3,"afs":3,"compactability":3,"date":"12-12-2012 12:00:00 AM","deadClay":3,"gcs":3,"loi":3,"moisture":3,"quantity":3,"shatterIndex":3,"shearStrength":3,"shift":"Morning","splittingStrength":3,"temperature":3,"time":"12-12-2012 12:00:00 AM","totalClay":3,"username":"manoj","sampleId":23},{"preparedsandId":60,"activeClay":4,"afs":4,"compactability":4,"date":"12-13-2012 12:00:00 AM","deadClay":4,"gcs":4,"loi":4,"moisture":4,"quantity":4,"shatterIndex":4,"shearStrength":4,"shift":"Morning","splittingStrength":4,"temperature":4,"time":"12-13-2012 12:00:00 AM","totalClay":4,"username":"manoj","sampleId":23},{"preparedsandId":61,"activeClay":5,"afs":5,"compactability":5,"date":"12-14-2012 12:00:00 AM","deadClay":5,"gcs":5,"loi":5,"moisture":5,"quantity":5,"shatterIndex":5,"shearStrength":5,"shift":"Morning","splittingStrength":5,"temperature":5,"time":"12-14-2012 12:00:00 AM","totalClay":5,"username":"manoj","sampleId":23},{"preparedsandId":62,"activeClay":6,"afs":6,"compactability":6,"date":"12-15-2012 12:00:00 AM","deadClay":6,"gcs":6,"loi":6,"moisture":6,"quantity":6,"shatterIndex":6,"shearStrength":6,"shift":"Morning","splittingStrength":6,"temperature":6,"time":"12-15-2012 12:00:00 AM","totalClay":6,"username":"manoj","sampleId":23},{"preparedsandId":63,"activeClay":7,"afs":7,"compactability":7,"date":"12-16-2012 12:00:00 AM","deadClay":7,"gcs":7,"loi":7,"moisture":7,"quantity":7,"shatterIndex":7,"shearStrength":7,"shift":"Morning","splittingStrength":7,"temperature":7,"time":"12-16-2012 12:00:00 AM","totalClay":7,"username":"manoj","sampleId":23},{"preparedsandId":64,"activeClay":8,"afs":8,"compactability":8,"date":"12-17-2012 12:00:00 AM","deadClay":8,"gcs":8,"loi":8,"moisture":8,"quantity":8,"shatterIndex":8,"shearStrength":8,"shift":"Morning","splittingStrength":8,"temperature":8,"time":"12-17-2012 12:00:00 AM","totalClay":8,"username":"manoj","sampleId":23},{"preparedsandId":65,"activeClay":9,"afs":9,"compactability":9,"date":"12-18-2012 12:00:00 AM","deadClay":9,"gcs":9,"loi":9,"moisture":9,"quantity":9,"shatterIndex":9,"shearStrength":9,"shift":"Morning","splittingStrength":9,"temperature":9,"time":"12-18-2012 12:00:00 AM","totalClay":9,"username":"manoj","sampleId":23},{"preparedsandId":66,"activeClay":10,"afs":10,"compactability":10,"date":"12-19-2012 12:00:00 AM","deadClay":10,"gcs":10,"loi":10,"moisture":10,"quantity":10,"shatterIndex":10,"shearStrength":10,"shift":"Morning","splittingStrength":10,"temperature":10,"time":"12-19-2012 12:00:00 AM","totalClay":10,"username":"manoj","sampleId":23},{"preparedsandId":67,"activeClay":11,"afs":11,"compactability":11,"date":"12-20-2012 12:00:00 AM","deadClay":11,"gcs":11,"loi":11,"moisture":11,"quantity":11,"shatterIndex":11,"shearStrength":11,"shift":"Morning","splittingStrength":11,"temperature":11,"time":"12-20-2012 12:00:00 AM","totalClay":11,"username":"manoj","sampleId":23},{"preparedsandId":68,"activeClay":12,"afs":12,"compactability":12,"date":"12-21-2012 12:00:00 AM","deadClay":12,"gcs":12,"loi":12,"moisture":12,"quantity":12,"shatterIndex":12,"shearStrength":12,"shift":"Morning","splittingStrength":12,"temperature":12,"time":"12-21-2012 12:00:00 AM","totalClay":12,"username":"manoj","sampleId":23},{"preparedsandId":69,"activeClay":13,"afs":13,"compactability":13,"date":"12-22-2012 12:00:00 AM","deadClay":13,"gcs":13,"loi":13,"moisture":13,"quantity":13,"shatterIndex":13,"shearStrength":13,"shift":"Morning","splittingStrength":13,"temperature":13,"time":"12-22-2012 12:00:00 AM","totalClay":13,"username":"manoj","sampleId":23},{"preparedsandId":70,"activeClay":14,"afs":14,"compactability":14,"date":"12-23-2012 12:00:00 AM","deadClay":14,"gcs":14,"loi":14,"moisture":14,"quantity":14,"shatterIndex":14,"shearStrength":14,"shift":"Morning","splittingStrength":14,"temperature":14,"time":"12-23-2012 12:00:00 AM","totalClay":14,"username":"manoj","sampleId":23},{"preparedsandId":71,"activeClay":1,"afs":1,"compactability":1,"date":"12-10-2012 12:00:00 AM","deadClay":1,"gcs":1,"loi":1,"moisture":1,"quantity":1,"shatterIndex":1,"shearStrength":1,"shift":"Morning","splittingStrength":1,"temperature":1,"time":"12-10-2012 12:00:00 AM","totalClay":1,"username":"manoj","sampleId":0},{"preparedsandId":72,"activeClay":2,"afs":2,"compactability":2,"date":"12-11-2012 12:00:00 AM","deadClay":2,"gcs":2,"loi":2,"moisture":2,"quantity":2,"shatterIndex":2,"shearStrength":2,"shift":"Morning","splittingStrength":2,"temperature":2,"time":"12-11-2012 12:00:00 AM","totalClay":2,"username":"manoj","sampleId":0},{"preparedsandId":73,"activeClay":3,"afs":3,"compactability":3,"date":"12-12-2012 12:00:00 AM","deadClay":3,"gcs":3,"loi":3,"moisture":3,"quantity":3,"shatterIndex":3,"shearStrength":3,"shift":"Morning","splittingStrength":3,"temperature":3,"time":"12-12-2012 12:00:00 AM","totalClay":3,"username":"manoj","sampleId":0},{"preparedsandId":74,"activeClay":4,"afs":4,"compactability":4,"date":"12-13-2012 12:00:00 AM","deadClay":4,"gcs":4,"loi":4,"moisture":4,"quantity":4,"shatterIndex":4,"shearStrength":4,"shift":"Morning","splittingStrength":4,"temperature":4,"time":"12-13-2012 12:00:00 AM","totalClay":4,"username":"manoj","sampleId":0},{"preparedsandId":75,"activeClay":5,"afs":5,"compactability":5,"date":"12-14-2012 12:00:00 AM","deadClay":5,"gcs":5,"loi":5,"moisture":5,"quantity":5,"shatterIndex":5,"shearStrength":5,"shift":"Morning","splittingStrength":5,"temperature":5,"time":"12-14-2012 12:00:00 AM","totalClay":5,"username":"manoj","sampleId":0},{"preparedsandId":76,"activeClay":6,"afs":6,"compactability":6,"date":"12-15-2012 12:00:00 AM","deadClay":6,"gcs":6,"loi":6,"moisture":6,"quantity":6,"shatterIndex":6,"shearStrength":6,"shift":"Morning","splittingStrength":6,"temperature":6,"time":"12-15-2012 12:00:00 AM","totalClay":6,"username":"manoj","sampleId":0},{"preparedsandId":77,"activeClay":7,"afs":7,"compactability":7,"date":"12-16-2012 12:00:00 AM","deadClay":7,"gcs":7,"loi":7,"moisture":7,"quantity":7,"shatterIndex":7,"shearStrength":7,"shift":"Morning","splittingStrength":7,"temperature":7,"time":"12-16-2012 12:00:00 AM","totalClay":7,"username":"manoj","sampleId":0},{"preparedsandId":78,"activeClay":8,"afs":8,"compactability":8,"date":"12-17-2012 12:00:00 AM","deadClay":8,"gcs":8,"loi":8,"moisture":8,"quantity":8,"shatterIndex":8,"shearStrength":8,"shift":"Morning","splittingStrength":8,"temperature":8,"time":"12-17-2012 12:00:00 AM","totalClay":8,"username":"manoj","sampleId":0},{"preparedsandId":79,"activeClay":9,"afs":9,"compactability":9,"date":"12-18-2012 12:00:00 AM","deadClay":9,"gcs":9,"loi":9,"moisture":9,"quantity":9,"shatterIndex":9,"shearStrength":9,"shift":"Morning","splittingStrength":9,"temperature":9,"time":"12-18-2012 12:00:00 AM","totalClay":9,"username":"manoj","sampleId":0},{"preparedsandId":80,"activeClay":10,"afs":10,"compactability":10,"date":"12-19-2012 12:00:00 AM","deadClay":10,"gcs":10,"loi":10,"moisture":10,"quantity":10,"shatterIndex":10,"shearStrength":10,"shift":"Morning","splittingStrength":10,"temperature":10,"time":"12-19-2012 12:00:00 AM","totalClay":10,"username":"manoj","sampleId":0},{"preparedsandId":81,"activeClay":11,"afs":11,"compactability":11,"date":"12-20-2012 12:00:00 AM","deadClay":11,"gcs":11,"loi":11,"moisture":11,"quantity":11,"shatterIndex":11,"shearStrength":11,"shift":"Morning","splittingStrength":11,"temperature":11,"time":"12-20-2012 12:00:00 AM","totalClay":11,"username":"manoj","sampleId":0},{"preparedsandId":82,"activeClay":12,"afs":12,"compactability":12,"date":"12-21-2012 12:00:00 AM","deadClay":12,"gcs":12,"loi":12,"moisture":12,"quantity":12,"shatterIndex":12,"shearStrength":12,"shift":"Morning","splittingStrength":12,"temperature":12,"time":"12-21-2012 12:00:00 AM","totalClay":12,"username":"manoj","sampleId":0},{"preparedsandId":83,"activeClay":13,"afs":13,"compactability":13,"date":"12-22-2012 12:00:00 AM","deadClay":13,"gcs":13,"loi":13,"moisture":13,"quantity":13,"shatterIndex":13,"shearStrength":13,"shift":"Morning","splittingStrength":13,"temperature":13,"time":"12-22-2012 12:00:00 AM","totalClay":13,"username":"manoj","sampleId":0},{"preparedsandId":84,"activeClay":14,"afs":14,"compactability":14,"date":"12-23-2012 12:00:00 AM","deadClay":14,"gcs":14,"loi":14,"moisture":14,"quantity":14,"shatterIndex":14,"shearStrength":14,"shift":"Morning","splittingStrength":14,"temperature":14,"time":"12-23-2012 12:00:00 AM","totalClay":14,"username":"manoj","sampleId":0}],"success":true} 
+1

顺便说一句,你真的应该接受更多的答案。 – nscrob 2012-07-20 13:20:26

+0

是的,我确定我接受的答案,但我不知道如何接受提前致谢 – Mayur 2012-07-21 07:43:15

+0

你有一个小检查左边的答案... – nscrob 2012-07-22 18:23:47

回答

0
//Result being your response from the request 
//you need to decode it 
var response = Ext.decode(result.responseText); 
var records = []; 
Ext.Array.each(response.preparedSandData, function(recordData) { 
    //each record needs to be instantiated to a model 
    var record = Ext.ModelManager.create(recordData, '*ModelClass*'); 
    records.push(record); 
}); 
//load all records at once 
store.loadRecords(records); 
+0

感谢您的回复但我想在其他页面使用该响应我无法访问其他页面中的响应对象。如何实现,请帮助我。提前致谢。 – Mayur 2012-07-21 07:44:28

+0

实际发生在我身上,我有搜索标准屏幕,还有其他屏幕是图表。现在我从搜索标准屏幕搜索一些东西,然后我得到了回应。与搜索成功,我正在创建新的图表和响应数据(我已经有回应)应该在商店加载。如果可能的话,是否有可能从其他页面的响应中加载数据,然后如何实现这一点请帮助我。提前致谢。 – Mayur 2012-07-21 07:48:38

+0

您并不需要将它看作两个不同的页面。如果它位于同一个extjs应用程序对象中,则该商店是全局的,因此您可以从任何您喜欢的地方加载它。你可以通过Ext.getStore('uniqueStoreId')来访问它。您可以通过将storeId添加到商店配置来设置自己的ID。 – nscrob 2012-07-22 18:22:46

相关问题