Dojo: Select a tab on load depending on url parameter

爱⌒轻易说出口 提交于 2019-12-11 12:12:49

问题


Is there a way to select a tab in a tab container upon load depending on a url parameter?

I have tried the following but nothing seems to happen and the tab I want is not selected:

dojo.addOnLoad(function() {
tabToSelect = getParameter("tab");
if(tabToSelect){
    dijit.byId("container").selectChild(tabToSelect); } }

I have console logged out the parameter and I know it is correct.

I have a strong feeling I am missing something....


回答1:


For those that might have the same question, I got the answer off the dojo mailing list, have to pass the actual tab instead of just a string, as follows:


    var tab = tabToSelect && dijit.byId(tabToSelect);
    if(tab){ dijit.byId("container").selectChild(tab)};

Works like a charm now!



来源:https://stackoverflow.com/questions/1799411/dojo-select-a-tab-on-load-depending-on-url-parameter

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!