2012-07-20 63 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

相關問題