Thanks for your kindly help. I am new to dojo and I have some further
questions wanna ask:
I can understand the function init(). And we need to connect a function
(e.g. onTab1Selected), which is called when the tab is shown, for each tab.
However, I am not sure how can I do it if the tab is generated dynamically.
Queenie
Jeromy Evans - Blue Sky Minds wrote:
>
> quinquin2209 wrote:
>> I have tried to store the last selected tab by setting
>> useSelectedTabCookie=true. It works fine as long as the tab remains.
>> However, problem occurs when the last selected is removed as follow:
>>
>> 1. User select tab "B"
>> 2. In the jsp, remove the tab with id "B"
>> 3. Refresh the browser
>>
>> Javascript error throw when the above steps are performed.
>>
>> Is there any way to solve it??
>>
>
> I didn't know this feature existed but it seems you've found a bug.
>
> I've always saved the selection in a cookie manually:
> 1. when a tab is selected, save the current tab's id in a cookie
> 2 when the page is loaded, read the cookie and set the selected tab
> (if it exists!)
>
> Code extract:
> Note i) createCookie and readCookie are your own functions
> ii) init* methods need to be called on the page load event
> (dojo.addOnLoad(...))
>
> Step 1: a setup listeners for a tab selection and write a cookie
>
> function onTab1Selected(evt) {
> createCookie("selectedTab", "tab1", 60);
> }
>
> function initListeners() {
> var tab1Widget = dojo.widget.byId("tab1");
> dojo.event.connect("before", tab1Widget, "show", onTab1Selected);
> }
>
> Step 2: on page load, read the cookie and set the selected tab
>
> function init() {
> var selectedTabId = readCookie(selectedTab);
> if (selectedTabId) {
> var selectedTabWidget = dojo.widget.byId("selectedTabId");
> if (selectedTabWidget ) {
> var tabbedContainerWidget = dojo.widget.byId("tabContainerId");
> tabbedContainerWidget.selectTab(selectedTabWidget);
> }
> }
> }
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>
>
--
View this message in context:
http://www.nabble.com/Tabbed-Panel-and-useSelectedTabCookie-tp14288927p14292641.html
Sent from the Struts - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]