我有以下功能,我嘗試將指定的url加載到新的或現有的選項卡(contentPane)中,但我大多數情況下都能工作,但是當指定現有選項卡時原始網址仍然重新加載,而不是添加新的HTML,我怎樣才能完成現有標籤傳遞的部分,而不必在創建新標籤時刪除屬性refreshOnShow?使用Dojo打開某個選項卡中的URL
openTab = function(url,title, id){
var tab = dijit.byId(id);
var centerPane = dijit.byId('centerPane');
if (tab){
//if target container exists then let's load the url and add it to the container
centerPane.selectChild(tab);
$.get(url, function(data) {
$('#'+id).html(data);
});
centerPane.selectChild(tab);
} else {
var newTab = new dijit.layout.ContentPane(
{
'title': title,
href:url,
closable:true,
selected:true,
parseOnLoad:true,
preventCache:true,
refreshOnShow:true
}, id);
centerPane.addChild(newTab);
centerPane.selectChild(newTab);
}
};
看來,如果我剛纔設置的** **的href屬性類似這樣的** tab.href =網址; **做訣竅,但是我不能通過同樣的方式重新設置現有標籤的標題:** tab.title = title; ** – MikeGA
嘗試使用'tab.set('title','我難以置信的標題') ' – mtyson
太棒了!這樣可行! – MikeGA