Using jquery custom widgets with backbone.js views -
i have custom jquery widget being called app uses backbone.js mvc. how can use backbone events pattern in custom jquery widget?
function( $ ) { $.widget( "medex.chooser", { ... _create: function() { // create new backbone view here??? } }
thanks.
i think need define custom view called custom widget.
in app initialization code, example:
app = {}; // app's global object app.views = {}; app.views.widgetview = backbone.view.extend( { events: { "click .grid1" : "ongrid1click" }, initialize: function() { // code here }, ongrid1click : function(evt) { // code here } });
then constructor code widget:
function widget(element) { this.view = new app.views.widgetview({ el: element }); }
this code might not entirely valid, should give idea of structure looking for. lemme know if works you.
Comments
Post a Comment