I am using backbone.js (0.5.3) with JQueryMobile (1.0 beta 2). I know there are routing conflicts when using those libraries together, and I would like to know if there is a solution to use them :
- without hacking into the jquery mobile source code like described in Ben Nolan's pots : http://bennolan.com/2010/11/23/backbone-and-jquery-mobile.html
- and without using another router like jquerymobile-router (unless there is no other option...)
My problem is quite similar to the one described in this post : jquery-mobile backbone.js routing
When when i make a request, the backbone render
code of the corresponding backbone view gets triggered before the new jquery page is fully loaded. I'm trying to render my html generated code in the $(".ui-page-active")
DOM element to target the page that is generated by jQueryMobile (or the page that is "activated") :
MyView = Backbone.View.extend({
el: $(".ui-page-active")
render: function(){
console.log(el)
}
});
But the el
attribute is empty when the render method is called, because jquery mobile has not yet rendered the dom...
Thanks for any help !
Update
Addy Osmani seems to have the answer to my question :) but it will be for the next part of his (great) tutorial : http://msdn.microsoft.com/en-us/scriptjunkie/hh377172.aspx
See Question&Answers more detail:os