For help with installation, bugs reports or feature requests, please head over to our new forums.
Genuitec Community on GitHub
- This topic has 2 replies, 3 voices, and was last updated 12 years, 5 months ago by
support-michael.
-
AuthorPosts
-
TorbenKjeldgaardMemberHi everyone,
I’m kind of new to jquery and mobione. So i run into some small issues now and then.
Right now I’m struggling with a problem in a list build from data from a webservices. Where (and how) in the code below must I put the code to transfere data to the next page? I want to transfer Header, Description ect.Thanks 🙂
function render_list( container_id , list_items ) {
var container = $(“#” + container_id);
var list = $(“ul[class*=m1-list]” , container);
var clone = $(“li:first” , list).clone();
var list_height = list.outerHeight();$(“li” , list).remove();
var length = list_items.length;
var item = null;for (var i = 0; i < length; i++) {
item = list_items[i];
$(clone).removeClass(“m1-first m1-last”);if(i == 0)
$(clone).addClass(“m1-first”);if(i == length-1)
$(clone).addClass(“m1-last”);$(clone).attr(“data-listitem-index” , i);
$(“div[id*=txtHeader]” , clone).text( item[“header”] );
$(“div[id*=txtLoc_name]” , clone).text( item[“loc_name”] );
$(“div[id*=txtDistance]” , clone).text( item[“distance”] );
$(“div[id*=txtAdtype]” , clone).text( item[“adtype”] );
$(“img[id*=imgImage]” , clone).attr( “src” , item[“image”] );
$(“div[id*=txtDiscount]” , clone).text( item[“discount”] );//Deal page
list.append( $(clone).clone());
}var panel_ht = list_height * length + 15;
$(“div[id*=scroller]” , container).attr(“data-layout-content-height”, panel_ht);phoneui.preprocessDOM(list);
phoneui.forceLayout();
}October 8, 2013 at 7:56 pm #343164
support-octavioMemberHi TKT,
We have not had a chance to look at your example. Unfortunately for this case our support policy is to address bugs and widget questions before we get commit resources to debugging a user’s code. I plan to take a look at it tomorrow and share advice.
October 9, 2013 at 5:36 am #343183
support-michaelKeymasterPlease give this example a look that retrieves data and updates across screens: http://www.genuitec.com/support-genuitec/viewtopic.php?f=14&t=6217 The key events to trigger data retrieval and screen population/update are the prePageTransition() and postPageTransition() handler functions that are defined in your project’s <project>_custom.js file.
Here is the javascript code (jquery is used heavily) used in the db-list project to make adjustments in the screen that is about to be navigated to:
/** * Notification that the UI is about to transition to a new screen. * Perform custom prescreen-transition logic here. * @param {String} currentScreenId * @param {String} targetScreenId * @returns {boolean} true to continue transtion; false to halt transition */ phoneui.prePageTransition = function(currentScreenId, targetScreenId) { if (currentScreenId == '#m1-new_item') { $('[id$=viewDbBtn]').focus(); } if (targetScreenId == '#m1-list_db') { setTimeout(updateListScreen,10); } else if (targetScreenId == '#m1-item') { updateItemScreen(); } else if (targetScreenId == '#m1-new_item') { clearNewItemScreen(); } return true; } -
AuthorPosts
