October 27, 2009
鼓勵此網誌:0
Extjs 內建的元件並不一定完全符合需求,
常常要自己用最原始的 HTML code 來兜出想要的元件。
這時就會用到 panel 的 html 屬性:
1: this.myPanel = new Ext.Panel({ 2: id: "myPanel", 3: html: "<h1>Hello</h1>" 4: }); |
那如果要動態修改 html 內的程式碼呢?
有個較簡單的方法:
1: this.myPanel.body.update("<h2>Hello World</h2>"); 2: this.myPanel.doLayout(); |
要記得呼叫 doLayout() 才會真正更新套用喔。








