2010-04-15 143 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