Commit 3fb4020d authored by Sven Franck's avatar Sven Franck

search: added pagebeforeshow method call when loading same page again

parent e8d8d423
...@@ -17,8 +17,10 @@ define([ ...@@ -17,8 +17,10 @@ define([
var matchesSelector = elem.matches || var matchesSelector = elem.matches ||
elem.webkitMatchesSelector || elem.webkitMatchesSelector ||
elem.mozMatchesSelector || elem.mozMatchesSelector ||
elem.msMatchesSelector; elem.msMatchesSelector,
oldbrowserReturn;
if (matchesSelector) {
while (elem) { while (elem) {
if (matchesSelector.bind(elem)(selector)) { if (matchesSelector.bind(elem)(selector)) {
return elem; return elem;
...@@ -27,6 +29,13 @@ define([ ...@@ -27,6 +29,13 @@ define([
} }
} }
return false; return false;
} else {
oldbrowserReturn = $( elem ).closest( selector );
if (oldBrowserReturn.length > 0) {
return oldBrowserReturn;
}
return false;
}
}; };
// generate items to display // generate items to display
...@@ -125,7 +134,14 @@ define([ ...@@ -125,7 +134,14 @@ define([
spec.source = source; spec.source = source;
spec.callback_mockup = callback_mockup; spec.callback_mockup = callback_mockup;
if (!spec.page.getAttribute("items_tag")) {
spec.page.setAttribute("items_tag", "true");
$(document).on("pagebeforeshow.items", spec.pageId, function (e) {
priv.generateItems(spec); priv.generateItems(spec);
});
// and run intial
priv.generateItems(spec);
}
}; };
that.callback = function (self) { that.callback = function (self) {
......
...@@ -12,7 +12,6 @@ define([ ...@@ -12,7 +12,6 @@ define([
value, runSearch; value, runSearch;
runSearch = function (value) { runSearch = function (value) {
console.log("running search with value ="+value);
$.mobile.changePage( "products.html", { $.mobile.changePage( "products.html", {
"transition": "slide", "transition": "slide",
"allowSamePageTransition": true, "allowSamePageTransition": true,
......
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