2010-04-15 144 views
1

我有一個現有的面板,其中餘與像這樣的可變手動設置HTML:使用Ext.Panel如何指定.php頁面作爲html源代碼?

s = '<H1>My Html Page'; 
s += '[more html]]'; 

var panel = new Ext.Panel({ 
      id: 'service_Billing', 
      title: 'Billing', 
      tbar: [], 
      html: s 
     }); 

如何指定一個PHP文件,而不是可變的作爲的源服務器相同的服務器上的路徑HTML。像/path/example/data.php

回答

7

您正在尋找autoLoad

var panel = new Ext.Panel({ 
    autoLoad: '/path/example/data.php', 
    id: 'service_Billing', 
    title: 'Billing', 
    tbar: [] 
}); 
+0

+1我忘記了! – timdev 2010-04-15 02:02:56

2

使用Ext.Ajax的東西來獲取內容並更新面板:

var panel = new Ext.Panel(...); 
Ext.Ajax.request({ 
    url: '/your/script.php', 
    success: function(response,opts){ 
    opts.panel.update(response.responseText); 
    }, 
    panel: panel 
}); 

或者類似的東西應該做到這一點。

+0

Ajax.request上沒有'panel'配置 - 你的意思是'scope'嗎?面板的'autoLoad'配置如@wombleton所示是最好的方法。 – 2010-04-15 03:16:51

+0

範圍也會起作用(並且可能更好)。我只是想在處理程序內部引用面板(這裏是:opts.panel)。這確實有用。 – timdev 2010-04-15 03:32:41