Commit 11d56a4b authored by Sven Franck's avatar Sven Franck

jqm_3: fixed gadget rendering on subsequent pages

parent e66eda08
...@@ -8,26 +8,31 @@ define([], function () { ...@@ -8,26 +8,31 @@ define([], function () {
var start = function () { var start = function () {
require(['overrides', 'jquery', 'jqm', 'jquery.json', 'renderjs'], require(['overrides', 'jquery', 'jqm', 'jquery.json', 'renderjs'],
function () { function () {
console.log("done loading");
console.log( $ ); $(document).on('pagebeforeshow','div:jqmData(role="page")', function () {
console.log( $.mobile );
console.log( $.mobile.autoInitializePage ); // renderJS handler
// START
if ($.mobile.autoInitializePage === false) {
// initialize JQM
$.mobile.initializePage();
console.log("init JQM");
// initialize renderJS
RenderJs.init(); RenderJs.init();
// when all gadgets are loaded make sure JQM renders them
RenderJs.bindReady( RenderJs.bindReady(
function () { function () {
console.log("bindReady called, trigger create"); $("[data-gadget]").filter(
$("[data-gadget]").trigger('create'); function() {
}); return $(this).jqmData("bound") !== true;
}
).each(
function () {
$(this).jqmData("bound",true).trigger('create');
}
)
}
);
});
// initialize JQM
if ($.mobile.autoInitializePage === false) {
$.mobile.initializePage();
} }
}); });
}; };
return {"start": start}; return {"start": start};
}); });
\ No newline at end of file
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment