javascriptbackbone.jsmarionette

Is there an easy way to refresh a region in Marionette?


I cannot seem to find a way to refresh a region of the page. I have a drop down select option that has the ability to add a new item to that drop down through a modal dialog. I want to redraw that region of the page that has that select option with the new item in it.

I can't seem to find a way to refresh that portion of the page in Marionette or Backbone. I know I could call

location.reload();

but I assume there is a better way.


Solution

  • I would suggest creating a collection to hold your drop-down items, and then use a Marionette.CompositeView to render the drop-down.
    You can then add items to the collection, and call the CompositeView.render() function.