问题
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