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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T14:57:16+00:00 2026-06-04T14:57:16+00:00

http://tinkerbin.com/pla4NzJ9 I’ve created a tiny demo, where a backbone view is instantiated and using

  • 0

http://tinkerbin.com/pla4NzJ9

I’ve created a tiny demo, where a backbone view is instantiated and using this.$el.jScrollPane(), a jScrollPane is attached to it.

When I re-render the view 5 seconds later, the jScrollPane disappears. Anyone know why?

Here I’ve duplicated the js:

var ScrollableView = Backbone.View.extend({
  initialize: function() {
    this.render();
  },

  render: function () {
    this.$el.html(_.template($('#scrollable_template').html(), {})); 
    this.$el.jScrollPane();
    return this;
  }
});

$(function () {
  var scrollableView = new ScrollableView({ el: $('#scrollable') });
  setTimeout(function() {
    scrollableView.render();
    console.log("re-rendered");
  }, 5000);
});
  • 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-04T14:57:17+00:00Added an answer on June 4, 2026 at 2:57 pm

    The plugin does this when you call this.$el.jScrollPane():

    return this.each(
        function()  
        {
            var elem = $(this), jspApi = elem.data('jsp'); 
            if (jspApi) {
                jspApi.reinitialise(settings); 
            } else {
                jspApi = new JScrollPane(elem, settings); 
                elem.data('jsp', jspApi);  
            }
        }   
    );
    

    Take note of the elem.data('jsp') check, that means that .jScrollPane() does something different the second time you call it on an element.

    When you do this:

    this.$el.html(_.template($('#scrollable_template').html(), {})); 
    

    Your killing off all the extra elements and event handlers that the first .jScrollPane() call added. Then you call .jScrollPane() again, it sees that .data('jsp') is there, so it probably assumes that everything is already there and doesn’t set things up properly.

    There is a destroy method in the jScrollPane API but I can’t get it to work. Manually removing the jsp data does seem to work though:

    render: function () {
      this.$el.removeData('jsp');
      this.$el.html(_.template($('#scrollable_template').html(), {})); 
      this.$el.jScrollPane();
      return this;
    }
    

    but I honestly don’t know if that’s going to do something nasty; I’d mess around with it more and try to get destroy working before doing removeDate('jsp') out of desperation.

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

Sidebar

Related Questions

Weird stuff happening here. See this tinkerbin page, if you may: http://tinkerbin.com/UZy6H6q4 Here's the
http://mindfulintegrations.com/signiacapital/accordian.php I am using Jquery Accordion UI and if you look at the above
http://developer.android.com/guide/topics/manifest/service-element.html#proc What are the differences? If the name assigned to this attribute begins with
http://jsfiddle.net/9BCrs/5/ I have this set up to load a file into a DIV using
There is an image slider at the top of this page: http://www.example.com/ Each slide
http://developer.yahoo.com/javascript/howto-proxy.html Are there disadvantages to this technique? The advantage is obvious, that you can
http://www.myserver.com/mypage.php?param1=abc&param2=123 I need to open this URL from a windows service either by IExplorer
http://weblog.rubyonrails.org/2009/1/26/nested-model-forms This post helped in learning how to handle multiple models in a rails
http://railskits.com/map/ Would you like to launch your own google map mashup? Need a way
http://www.validome.org/xml/validate/?lang=en&viewSourceCode=1&url=http://45143.com/finance-feed/abc.xml&onlyWellFormed=1 check the url above for validator results. Line 171 in the XSD is

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.