次のようなタブパネルがあります。
var tab1 = {
id: 'section1',
title: 'First Section',
padding: 10,
html: '(this content will be replaced with an ajax load)'
}
var tab2 = {
id: 'section2',
title: 'Second Section',
padding: 10,
html: '(this content will be replaced with an ajax load)'
}
var tab3 = {
id: 'section3',
title: 'Third Section',
padding: 10,
html: '(this content will be replaced with an ajax load)'
}
var modules_info_panel = new Ext.TabPanel({
region: 'center',
activeTab: 0,
border: false,
defaults:{autoScroll:true},
items:[tab1, tab2, tab3]
});
次に、このタブパネルを作成した後、タブのコンテンツを動的に変更したいと思いますが、これらはどれも機能しません:
tab1.html = 'new html'; // no effect
tab1.title = 'new title'; // no effect
tab1.update('new text'); // error: tab1.update is not a function
viewport.doLayout(); // no effect
AJAXを介して各タブのコンテンツをロードしたいので、この質問で提案されているようにタブを動的に追加したくありませんが、タブが最初のロードから表示され、クリックされたときに各タブのコンテンツが動的に変更されるようにします.
作成後にタブのコンテンツを変更するにはどうすればよいですか?
アップデート:
私の見落としを見つけてくれた@Chauに感謝します。Ext.Panel
単純なjavascriptオブジェクトリテラルの代わりにタブを作成すると、機能します:
var tab1 = new Ext.Panel ({
id: 'section1',
title: 'First Section',
padding: 10,
html: '(this content will be replaced with an ajax load)'
});
var tab2 = new Ext.Panel ({
id: 'section2',
title: 'Second Section',
padding: 10,
html: '(this content will be replaced with an ajax load)'
});
var tab3 = new Ext.Panel ({
id: 'section3',
title: 'Third Section',
padding: 10,
html: '(this content will be replaced with an ajax load)'
});
var modules_info_panel = new Ext.TabPanel({
region: 'center',
activeTab: 0,
border: false,
defaults:{autoScroll:true},
items:[tab1, tab2, tab3]
});
tab1.update('new content with update'); //works