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 9017787
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T04:21:43+00:00 2026-06-16T04:21:43+00:00

Does anyone have any thoughts on why this darn view won’t update when performing

  • 0

Does anyone have any thoughts on why this darn view won’t update when performing a .set on the model? I think if might have to do with the render functionality I’ve put in…

Backbone View:

    App.Views.PanelOne = Backbone.View.extend({


    initialize: function() {
        console.log("View PanelOne Initialized");

        panelonesetting = this.model.get('panel_one');
        console.log( panelonesetting );

        _.bindAll(this, 'render');
        this.model.bind('change', this.render);

    },

    render: function(){
        if ( panelonesetting == "poolprice" ){
            this.$el.html(JST['dashboard/poolprice']({}));
        return this;
        };
        if ( panelonesetting == "none" ){
            this.$el.html(JST['dashboard/none']({}));
        return this;
        };
        if ( panelonesetting == "noconnection" ){
            this.$el.html(JST['dashboard/noconnection']({}));
        return this;
        };
    }


});

Backbone Router:

App.Routers.Dashboard = Backbone.Router.extend({

    routes: {
        ""          : "index"       
        },

    initialize: function(options) {
    console.log("Router initialized");
      preflist = new App.Models.PrefList({});

    preflist.fetch({
        success: function() {
            console.log( preflist );
          paneloneview = new App.Views.PanelOne({ model: preflist });
          $('#panelone').html(paneloneview.render().$el);             
        }  
    });
  },

    index: function() {

    }


});
  • 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-16T04:21:45+00:00Added an answer on June 16, 2026 at 4:21 am

    You have some accidental globals. In particular, you have this in your view’s initialize:

    panelonesetting = this.model.get('panel_one');
    

    and then the render looks at panelonesetting. There is no var on that panelonesetting so it is a global variable.

    The initialize method is called when you construct your view and it is never called again; that means that panelonesetting will be assigned the initial panel_one value and then it is never updated. So, if the model is changed, your render will be called but it will be looking at the original panel_one setting. The result is that nothing seems to change: you can call your render as many times as you want with whatever model changes you want and you’ll never see anything happen.

    You should be checking the value of panel_one inside your render method:

    initialize: function() {
        _.bindAll(this, 'render');
        this.model.bind('change', this.render);
    },
    
    render: function(){
        var panelonesetting = this.model.get('panel_one');
        if(panelonesetting == "poolprice")
            this.$el.html(JST['dashboard/poolprice']({}));
        if(panelonesetting == "none")
            this.$el.html(JST['dashboard/none']({}));
        if(panelonesetting == "noconnection")
            this.$el.html(JST['dashboard/noconnection']({}));
        return this;
    }
    

    Your preflist andpaneloneview` variables in your router are also global when they should almost certainly be local.

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

Sidebar

Related Questions

Does anyone have any thoughts on this method? I have did some performance testing
Does anyone have any examples on how to integrate a task scheduler in Bottle.
Does anyone have any idea how to change the thickness of the text pointer
DOes anyone have any good information with regards to when to log, I was
Does anyone have any tips that could help speed up a process of breaking
Does anyone have any useful advice/links to information about working with mp3 files in
Does anyone have any advice or techniques for deploying SSIS packages to the Integration
Does anyone have any experience querying FlexLM? (At a minimum) I need to be
Does anyone have any advice on which method is better when caching data in
Does anyone have any recommendations of resources for learning ASP.NET specifically? I have a

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.