2011-09-13 26 views
0

我熟悉如何處理JSON回送的數據使用數據存儲:想要將html轉發給extjs reader而不是json?

new Ext.data.Store({ 
     model: "VehicleInfo", 
     proxy: { 
      type: "ajax", 
      url : "vehicleinfo.php", 
      reader: { 
        type: "json" 
      } 
     }, 
     });  

但我怎麼配置閱讀器,以便它接受一個HTML響應?我打算在面板中回顯整個html響應。

謝謝。

回答

2

您可能不想使用商店更新面板內容。有幾種直接更新面板主體內容的方法。 1.在配置中使用autoLoad。 2.直接設置html,可能來自其他ajax調用。 3.使用Ext.Panel加載方法讓Ext進行ajax調用並用響應更新面板主體。

panel = new Ext.Panel({ 
    renderTo: Ext.getBody(), 
    width:450, 
    frame:true, 
    defaults:{autoHeight: true}, 
    // use autoLoad to have content created when the panel first renders 
    autoLoad: 'vehicleinfo.php' 
    }); 

    // use one or the other of the two below 

    // set html directly 
    panel.update('Examples of <strong>direct html<strong>'); 

    // set html by having Ext do an Ajax call to get panel content 
    panel.load('vehicleinfo.php'); 
+0

感謝約翰。這教會了我很多。 –

+0

大衛沒問題。我很高興能夠提供幫助。 –

相關問題