我有以下功能,我尝试将指定的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