|
View:
New views
9 Messages
—
Rating Filter:
Alert me
|
|
|
"selectChild is not a function"?!Hi,
I'm using Dojo 0.9. I'm trying to have a tab within a TabContainer selected when the page loads, based on what the page's anchor tag says. But when I invoke this line: dojo.byId("tabs").selectChild(selectedTab); I get the JS error, "selectChild is not a function". Where's it all falling apart? I've also tried "selectTab" with the same disappointing JS error. Below is my code. Thanks, - Dave <div dojoType="dijit.layout.LayoutContainer" id="main" jsId="main"> <script type="dojo/method"> var selectedTabId = location.hash == "#addApp" ? "addApp" : "configApp"; var selectedTab = dojo.byId(selectedTab); dojo.byId("tabs").selectChild(selectedTab); </script> <div dojoType="dijit.layout.ContentPane" layoutAlign="top" id="applicationHeader" jsId="applicationHeader"> <div class="userFunctions"> <h:form> Logged in as: <h:outputText value='#{sessionScope.USERCREDENTIAL.userName}'/> | <h:outputLink value="#{ConfigLoginBean.logoutURL}"> <h:outputText value="Sign Out"/> </h:outputLink> </h:form> </div> <div class="header"> <div class="headerRt" id="divHeader"> NPS Application Configuration </div> </div> </div> <div dojoType="dijit.layout.TabContainer" id="tabs" jsId="tabs" layoutAlign="client"> <div dojoType="dijit.layout.ContentPane" layoutAlign="client" title="Configure Applications" id="configApp" jsId="configApp"> <iframe id="configFrame" src="ConfigGrid.jsf" height="100%" width="100%" frameborder="0"></iframe> </div> <div dojoType="dijit.layout.ContentPane" layoutAlign="client" title="Edit Applications" id="addApp" jsId="addApp"> <iframe id="appAppFrame" src="AddApplication.jsf" height="100%" width="100%" frameborder="0"></iframe> </div> </div> </div> _______________________________________________ FAQ: http://dojotoolkit.org/support/faq Book: http://dojotoolkit.org/docs/book Forums: http://dojotoolkit.org/forum Dojo-interest@... http://turtle.dojotoolkit.org/mailman/listinfo/dojo-interest |
|
|
Re: "selectChild is not a function"?!try dijit.byId("tabs").selectChild(selectedTab);
On Jul 23, 2008, at 1:04 PM, <dave.alvarado@...> <dave.alvarado@... > wrote: > Hi, > > I'm using Dojo 0.9. I'm trying to have a tab within a TabContainer > selected when the page loads, based on what the page's anchor tag > says. But when I invoke this line: > > dojo.byId("tabs").selectChild(selectedTab); > > I get the JS error, "selectChild is not a function". Where's it all > falling apart? I've also tried "selectTab" with the same > disappointing JS error. Below is my code. > > Thanks, - Dave > > > <div dojoType="dijit.layout.LayoutContainer" id="main" > jsId="main"> > <script type="dojo/method"> > var selectedTabId = location.hash == > "#addApp" ? "addApp" : "configApp"; > var selectedTab = dojo.byId(selectedTab); > dojo.byId("tabs").selectChild(selectedTab); > </script> > <div dojoType="dijit.layout.ContentPane" > layoutAlign="top" id="applicationHeader" jsId="applicationHeader"> > <div class="userFunctions"> > <h:form> > Logged in as: <h:outputText > value='#{sessionScope.USERCREDENTIAL.userName}'/> | > <h:outputLink > value="#{ConfigLoginBean.logoutURL}"> <h:outputText value="Sign Out"/ > > </h:outputLink> > </h:form> > </div> > <div class="header"> > <div class="headerRt" id="divHeader"> > NPS Application Configuration > </div> > </div> > </div> > <div dojoType="dijit.layout.TabContainer" id="tabs" > jsId="tabs" > layoutAlign="client"> > <div dojoType="dijit.layout.ContentPane" > layoutAlign="client" > title="Configure Applications" id="configApp" > jsId="configApp"> > <iframe id="configFrame" > src="ConfigGrid.jsf" height="100%" width="100%" frameborder="0"></ > iframe> > </div> > <div dojoType="dijit.layout.ContentPane" > layoutAlign="client" > title="Edit Applications" id="addApp" > jsId="addApp"> > <iframe id="appAppFrame" > src="AddApplication.jsf" height="100%" width="100%" > frameborder="0"></iframe> > </div> > > </div> > </div> > _______________________________________________ > FAQ: http://dojotoolkit.org/support/faq > Book: http://dojotoolkit.org/docs/book > Forums: http://dojotoolkit.org/forum > Dojo-interest@... > http://turtle.dojotoolkit.org/mailman/listinfo/dojo-interest _______________________________________________ FAQ: http://dojotoolkit.org/support/faq Book: http://dojotoolkit.org/docs/book Forums: http://dojotoolkit.org/forum Dojo-interest@... http://turtle.dojotoolkit.org/mailman/listinfo/dojo-interest |
|
|
|
|
|
Re: "selectChild is not a function"?!If you are outputing this page from a backed why not just output the HTML with <div id="myTab" selected="true">mytab content</div> OR, move your dojo/method to dojo.addOnLoad where it will fire after widget creation because right now its firing before the tab Container is setupfrom the sounds of it...
-Karl Tiedt On Wed, Jul 23, 2008 at 3:46 PM, <dave.alvarado@...> wrote: Thanks but that didn't work. I changed my code to: _______________________________________________ FAQ: http://dojotoolkit.org/support/faq Book: http://dojotoolkit.org/docs/book Forums: http://dojotoolkit.org/forum Dojo-interest@... http://turtle.dojotoolkit.org/mailman/listinfo/dojo-interest |
|
|
|
|
|
Re: "selectChild is not a function"?!dijit.byId('tabs').selectChild().... As for via the backend... change your #tags to use GET vars instead?
-Karl Tiedt On Wed, Jul 23, 2008 at 5:13 PM, <dave.alvarado@...> wrote: I tried moving to dojo.addOnLoad, _______________________________________________ FAQ: http://dojotoolkit.org/support/faq Book: http://dojotoolkit.org/docs/book Forums: http://dojotoolkit.org/forum Dojo-interest@... http://turtle.dojotoolkit.org/mailman/listinfo/dojo-interest |
|
|
Re: "selectChild is not a function"?!so looking at the addOnLoad you have:
selectedTabId = get the hash etc etc. you don't use ID again, the next line is: var selectedTab = dojo.byId(selectedTab), I suspect you want: var selectedTab = dijit.byId(selectedTabId); and then, again, dijit.byId("tabs").selectChild(selectedTab); dojo.byId is for domNodes, dijit.byId is for widgets. Regards, Peter Higgins dave.alvarado@... wrote: > I tried moving to dojo.addOnLoad, > > dojo.addOnLoad(function() { > var selectedTabId = location.hash == "#addApp" ? "addApp" : "configApp"; > var selectedTab = dojo.byId(selectedTab); > dojo.byId("tabs").selectChild(selectedTab); > }); > > but I still get the error, "dojo.byId("tabs").selectChild is not a function" > > > You're idea of outputting the selected tab from the server is also a good one, but I'm told that is impossible to do with anchors within the URL: > > http://forums.sun.com/thread.jspa?threadID=5316849 > > This can't be that hard, can it? - Dave > > > > >> -------Original Message------- >> From: Karl Tiedt <ktiedt@...> >> Subject: Re: [Dojo-interest] "selectChild is not a function"?! >> Sent: Jul 23 '08 21:16 >> >> If you are outputing this page from a backed why not just output the HTML >> with <div id="myTab" selected="true">mytab content</div> OR, move your >> dojo/method to dojo.addOnLoad where it will fire after widget creation >> because right now its firing before the tab Container is setupfrom the >> sounds of it... >> >> -Karl Tiedt >> >> >> On Wed, Jul 23, 2008 at 3:46 PM, <[LINK: >> mailto:dave.alvarado@...] dave.alvarado@...> >> wrote: >> Thanks but that didn't work. I changed my code to: >> >> >> <script type="dojo/method"> >> var selectedTabId = location.hash == "#addApp" ? >> "addApp" : "configApp"; >> var selectedTab = dijit.byId(selectedTab); >> >> dijit.byId("tabs").selectChild(selectedTab); >> </script> >> >> and got the JS error: "dijit.byId("tabs") is undefined" >> >> Any other suggestions are much appreciated, - Dave >> >> >> > -------Original Message------- >> > From: Maulin Shah <[LINK: mailto:maulinpshah@...] >> maulinpshah@...> >> > Subject: Re: [Dojo-interest] "selectChild is not a function"?! >> > Sent: Jul 23 '08 20:20 >> > >> > try dijit.byId("tabs").selectChild(selectedTab); >> > >> > >> > On Jul 23, 2008, at 1:04 PM, <[LINK: >> mailto:dave.alvarado@...] dave.alvarado@...> >> <[LINK: mailto:dave.alvarado@...] >> dave.alvarado@... >> > > wrote: >> > >> > > Hi, >> > > >> > > I'm using Dojo 0.9. I'm trying to have a tab within a >> TabContainer >> > > selected when the page loads, based on what the page's anchor >> tag >> > > says. But when I invoke this line: >> > > >> > > dojo.byId("tabs").selectChild(selectedTab); >> > > >> > > I get the JS error, "selectChild is not a function". Where's it >> all >> > > falling apart? I've also tried "selectTab" with the same >> > > disappointing JS error. Below is my code. >> > > >> > > Thanks, - Dave >> > > >> > > >> > > <div dojoType="dijit.layout.LayoutContainer" id="main" >> > > jsId="main"> >> > > <script type="dojo/method"> >> > > var selectedTabId = location.hash == >> > > "#addApp" ? "addApp" : "configApp"; >> > > var selectedTab = dojo.byId(selectedTab); >> > > dojo.byId("tabs").selectChild(selectedTab); >> > > </script> >> > > <div dojoType="dijit.layout.ContentPane" >> > > layoutAlign="top" id="applicationHeader" jsId="applicationHeader"> >> > > <div class="userFunctions"> >> > > <h:form> >> > > Logged in as: <h:outputText >> > > value='#{sessionScope.USERCREDENTIAL.userName}'/> | >> > > <h:outputLink >> > > value="#{ConfigLoginBean.logoutURL}"> <h:outputText value="Sign >> Out"/ >> > > > </h:outputLink> >> > > </h:form> >> > > </div> >> > > <div class="header"> >> > > <div class="headerRt" id="divHeader"> >> > > NPS Application Configuration >> > > </div> >> > > </div> >> > > </div> >> > > <div dojoType="dijit.layout.TabContainer" id="tabs" >> > > jsId="tabs" >> > > layoutAlign="client"> >> > > <div dojoType="dijit.layout.ContentPane" >> > > layoutAlign="client" >> > > title="Configure Applications" id="configApp" >> >> > > jsId="configApp"> >> > > <iframe id="configFrame" >> > > src="ConfigGrid.jsf" height="100%" width="100%" frameborder="0"></ >> > > iframe> >> > > </div> >> > > <div dojoType="dijit.layout.ContentPane" >> > > layoutAlign="client" >> > > title="Edit Applications" id="addApp" >> > > jsId="addApp"> >> > > <iframe id="appAppFrame" >> > > src="AddApplication.jsf" height="100%" width="100%" >> > > frameborder="0"></iframe> >> > > </div> >> > > >> > > </div> >> > > </div> >> > > _______________________________________________ >> > > FAQ: [LINK: http://dojotoolkit.org/support/faq] >> http://dojotoolkit.org/support/faq >> > > Book: [LINK: http://dojotoolkit.org/docs/book] >> http://dojotoolkit.org/docs/book >> > > Forums: [LINK: http://dojotoolkit.org/forum] >> http://dojotoolkit.org/forum >> > > [LINK: mailto:Dojo-interest@...] >> Dojo-interest@... >> > > [LINK: http://turtle.dojotoolkit.org/mailman/listinfo/dojo-interest] >> http://turtle.dojotoolkit.org/mailman/listinfo/dojo-interest >> > >> > _______________________________________________ >> > FAQ: [LINK: http://dojotoolkit.org/support/faq] >> http://dojotoolkit.org/support/faq >> > Book: [LINK: http://dojotoolkit.org/docs/book] >> http://dojotoolkit.org/docs/book >> > Forums: [LINK: http://dojotoolkit.org/forum] >> http://dojotoolkit.org/forum >> > [LINK: mailto:Dojo-interest@...] >> Dojo-interest@... >> > [LINK: http://turtle.dojotoolkit.org/mailman/listinfo/dojo-interest] >> http://turtle.dojotoolkit.org/mailman/listinfo/dojo-interest >> > >> _______________________________________________ >> FAQ: [LINK: http://dojotoolkit.org/support/faq] >> http://dojotoolkit.org/support/faq >> Book: [LINK: http://dojotoolkit.org/docs/book] >> http://dojotoolkit.org/docs/book >> Forums: [LINK: http://dojotoolkit.org/forumDojo-interest@...] >> http://dojotoolkit.org/forum >> Dojo-interest@... >> [LINK: http://turtle.dojotoolkit.org/mailman/listinfo/dojo-interest] >> http://turtle.dojotoolkit.org/mailman/listinfo/dojo-interest >> >> >> -------------------- >> _______________________________________________ >> FAQ: [LINK: http://dojotoolkit.org/support/faq] >> http://dojotoolkit.org/support/faq >> Book: [LINK: http://dojotoolkit.org/docs/book] >> http://dojotoolkit.org/docs/book >> Forums: [LINK: http://dojotoolkit.org/forum] http://dojotoolkit.org/forum >> [LINK: compose.php?to=Dojo-interest@...] >> Dojo-interest@... >> [LINK: http://turtle.dojotoolkit.org/mailman/listinfo/dojo-interest] >> http://turtle.dojotoolkit.org/mailman/listinfo/dojo-interest >> > _______________________________________________ > FAQ: http://dojotoolkit.org/support/faq > Book: http://dojotoolkit.org/docs/book > Forums: http://dojotoolkit.org/forum > Dojo-interest@... > http://turtle.dojotoolkit.org/mailman/listinfo/dojo-interest > > _______________________________________________ FAQ: http://dojotoolkit.org/support/faq Book: http://dojotoolkit.org/docs/book Forums: http://dojotoolkit.org/forum Dojo-interest@... http://turtle.dojotoolkit.org/mailman/listinfo/dojo-interest |
|
|
Re: "selectChild is not a function"?!No its not hard at all, you simply aren't getting a reference to the tab container. The code below doesn't appear to be correct: var selectedTab = dojo.byId(selectedTab); I would guess is supposed to be selectedTabId. The dojo.byId("tabs") line shoudl be dijit.byId("tabs") .... dojo.byId retrieves domNodes, dijit.byId() retrieves widgets. Dustin dave.alvarado@... wrote: > I tried moving to dojo.addOnLoad, > > dojo.addOnLoad(function() { > var selectedTabId = location.hash == "#addApp" ? "addApp" : "configApp"; > var selectedTab = dojo.byId(selectedTab); > dojo.byId("tabs").selectChild(selectedTab); > }); > > but I still get the error, "dojo.byId("tabs").selectChild is not a function" > > > You're idea of outputting the selected tab from the server is also a good one, but I'm told that is impossible to do with anchors within the URL: > > http://forums.sun.com/thread.jspa?threadID=5316849 > > This can't be that hard, can it? - Dave > > > > >> -------Original Message------- >> From: Karl Tiedt <ktiedt@...> >> Subject: Re: [Dojo-interest] "selectChild is not a function"?! >> Sent: Jul 23 '08 21:16 >> >> If you are outputing this page from a backed why not just output the HTML >> with <div id="myTab" selected="true">mytab content</div> OR, move your >> dojo/method to dojo.addOnLoad where it will fire after widget creation >> because right now its firing before the tab Container is setupfrom the >> sounds of it... >> >> -Karl Tiedt >> >> >> On Wed, Jul 23, 2008 at 3:46 PM, <[LINK: >> mailto:dave.alvarado@...] dave.alvarado@...> >> wrote: >> Thanks but that didn't work. I changed my code to: >> >> >> <script type="dojo/method"> >> var selectedTabId = location.hash == "#addApp" ? >> "addApp" : "configApp"; >> var selectedTab = dijit.byId(selectedTab); >> >> dijit.byId("tabs").selectChild(selectedTab); >> </script> >> >> and got the JS error: "dijit.byId("tabs") is undefined" >> >> Any other suggestions are much appreciated, - Dave >> >> >> > -------Original Message------- >> > From: Maulin Shah <[LINK: mailto:maulinpshah@...] >> maulinpshah@...> >> > Subject: Re: [Dojo-interest] "selectChild is not a function"?! >> > Sent: Jul 23 '08 20:20 >> > >> > try dijit.byId("tabs").selectChild(selectedTab); >> > >> > >> > On Jul 23, 2008, at 1:04 PM, <[LINK: >> mailto: |