Search code examples
viewbackbone.jsnavigationcoffeescriptchaplinjs

Prevent a view in chaplin.js from being rerendered


I'm playing around a little with a Chaplin App and try to add a class to a link in my navigation depending on the routed URL.

# navigation_view.coffee

initialize: ->
  super
  @subscribeEvent '!router:changeURL', @setActiveNavigation

setActiveNavigation: (path) ->
  $('nav a[href="/' + path + '"]').addClass "active"

That works pretty well for the fraction of a second until the whole navigationView is being rerendered. autoRender is set to false. Does anybody know how to prevent the view from being rerendered?

Thanks a lot


Solution

  • Never mind, I forgot about the @subscribeEvent 'startupController', @render and now without that it works fine.