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

  • SEARCH
  • Home
  • 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 8997185
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T23:51:16+00:00 2026-06-15T23:51:16+00:00

I am currently using emberjs to build an app, im getting near completiion but

  • 0

I am currently using emberjs to build an app, im getting near completiion but i have some inconsistency related to the didInsertElement method related to a view in the app.
Here is the code :

     didInsertElement : function(){           
        Ember.run.next(this,function(){
            var sub = this.$(document).find('.sub_t');
            $(sub).not('button').siblings('.inside').toggle();
            $(sub).each(function(i){
                $(this).attr('id','s_t' + i + '');
                var s_t = $(this).nextUntil(".sub_t");
                $(s_t).not('button').wrapAll("<div class='s_t" + i + "'></div>");
            });
         });
    },

The problem is that even if i am not using the Ember.run.next the app view is reacting inconsistently. Im just trying to modify the content in my view. Sometimes the jquery works sometimes it is not and its unclear how to reproduce this bug.

Is it related to the size of the file beign loaded?
Or is it a misuse of the Ember run loop or the did insert element method?

Anybody has a cue on that? or a hint on what is happening and what i might do to work this out?

  • 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-15T23:51:17+00:00Added an answer on June 15, 2026 at 11:51 pm

    When didInsertElement is called you are guaranteed that the view’s element has been added to the DOM. If you want to also guarantee that the view’s child views have been added as well, you can schedule an action on the afterRender queue, which was added here. i.e.

    Ember.run.scheduleOnce('afterRender', this, function(){
        // do something when my view hierarchy has been rendered
    });
    

    This would replace Ember.run.next, which is rarely a good idea in an didInsertElement handler.

    In addition, within the didInsertElement handler, you should almost always be using the scoped jQuery selector this.$(), instead of the global $.

    Between those two hints, you should be able to get things working consistently. If you can’t, you could create a JSFiddle showing a simplified version of what you’re trying to accomplish, and I’d be happy to look at it.

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

Sidebar

Related Questions

I currently using android NDK to write some native code in C. I have
Im currently using C# to pass some objects to powershell and executing a method
We're currently using JUnit 4.4 and Ant 1.7.1 for our builds. I have some
I'm currently using the MessageUI framework for sending SMS and Emails, but my app
Currently using the HTTPServletRequest class and specifically the .getQueryString method to retrieve an inputted
Currently using Google Analytics as a supplement to our paid tracking software, but neither
Currently using MySQL version 5.1.6 This is my first real world build and so
Currently using Xcode 4.2 and I have two view controllers (1 and 2). I
Currently using: @^(ht|f)tp(s?)\:\/\/[0-9a-zA-Z]([-.\w]*[0-9a-zA-Z])*(:(0-9)*)*(\/?)([a-zA-Z0-9\-\.\?\,\'\/\\\+&amp;%\$#_]*)?$ How can i make http:// not compulsory but if it does
so currently using ajax with JQuery .post to return a form populate with some

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.