Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8943109
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T11:41:35+00:00 2026-06-15T11:41:35+00:00

HTML <div id=activities></div> <div id=activity-edit></div>​ JavaScript require([ ‘dojo/ready’, ‘dojo/dom’, ‘dijit/registry’, ‘dojox/mobile/parser’, ‘dojox/mobile/deviceTheme’, ‘dojox/mobile/compat’, ‘dojox/mobile/Icon’,

  • 0

HTML

<div id="activities"></div>
<div id="activity-edit"></div>​

JavaScript

require([
    'dojo/ready', 'dojo/dom', 'dijit/registry', 'dojox/mobile/parser', 'dojox/mobile/deviceTheme', 'dojox/mobile/compat', 'dojox/mobile/Icon', 'dojox/mobile/ScrollableView', 'dojox/mobile/Heading', 'dojox/mobile/ToolBarButton', 'dojox/mobile'
],
function(ready, dom, registry, parser, deviceTheme, compat, Icon, ScrollableView, Heading, ToolBarButton, mobile) {
    ready(function() {
        var view_activities = new ScrollableView(null, 'activities');
        view_activities.selected = true;

        var heading = new Heading({
            label: 'Activities',
            fixed: 'top'
        });
        view_activities.addFixedBar(heading);

        var button = new ToolBarButton({
            icon: 'mblDomButtonWhitePlus',
            style: 'float:right;',
            moveTo: 'activity-edit',
            onClick: function(e) {
                click_activity_edit(e, 0);
            }
        });
        heading.addChild(button);

        var view_activity_edit = new ScrollableView(null, 'activity-edit');

        view_activities.startup();
    });

    this.click_activity_edit = function(e, activityid) {
        var view_activity_edit = registry.byId('activity-edit');
        view_activity_edit.destroyDescendants(false);

        heading = new Heading({
            id: 'heading-activity-edit',
            label: 'Activity',
            fixed: 'top'
        });
        view_activity_edit.addChild(heading);

        var button = new ToolBarButton({
            label: 'Cancel',
            moveTo: 'activities',
            transitionDir: -1,
            arrow: 'left'
        });
        heading.addChild(button);

        button = new ToolBarButton({
            label: 'Save',
            style: 'float:right;',
            moveTo: 'activities',
            transitionDir: -1,
            onClick: function(e) {
                click_activity_save(e, activityid, function() {
                    data.get_activities(request, handle_getActivities);
                });
            }
        });
        heading.addChild(button);

        view_activity_edit.startup();
    };

    parser.parse();
});​

Steps to recreate the behavior:

Click the “+” button, click “Cancel”, click the “+” button again, click “Cancel” again and the button no longer works.

If you replace addFixedBar with addChild, the button works as expected every time. I would do this, but I need the Heading to be fixed given that it is on a ScrollableView.

I understand that addFixedBar adds the widget to the domNode and not the containerNode, but I don’t understand why that affects the behavior of the button and only on the second pass. My guess is that it has something to do with the destroyDescendants call not actually removing the Heading when using addFixedBar. I tried destroying the Heading manually after calling destroyDescendants, but that didn’t work. The heading is undefined/null on the second pass whether I get the Heading by “dom” or “registry”.

Any help or explanation is appreciated.

EDIT

Here is the JSFiddle: http://jsfiddle.net/MPUvk/

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T11:41:37+00:00Added an answer on June 15, 2026 at 11:41 am

    The key is the startup() calls.

    The view_activity_edit.startup() call will work only once (startup() sets an internal _started flag and does nothing when it is already set). The second time the view is created, startup() does nothing.

    The different behaviors between addFixedBar and addChild are because addChild calls startup() internally, whereas addFixedBar does not.

    So to fix, just add heading.startup() after the addFixedBar call, that should work.
    Another possibility would be to reset view_activity_edit._started = false when you destroy the view.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to add row with remove button through javascript in html div formate.
I have a loop for my Activity model <% @activities.each do |activity| %> <div>
I basically just want to append a javascript variable to an HTML div with
I am trying to generate an html div in asp.net. Since a div is
What is the best way to set the transparency of a HTML DIV element
I have created a simple layout using the HTML div tag. I would like
how can i convert xpath like /html/body/div[3]/ul/li[1]/a[5] html > body > div[3] > ul
In jQuery we usually use, for example: var content = $('tr#someid td').find('div').html(); var content
Given: Url - http://www.contoso.com/search.php?q= {param} returns: -html- --body- {...} ---div id='foo'- ----div id='page1'/- ----div
here is link to an example: http://techchorus.net/demos/jquery/hiding-input-elements-in-a-div.html It actally disables few elements on click

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.