- This topic has 4 replies, 3 voices, and was last updated 11 years, 7 months ago by epet.
-
AuthorPosts
-
epetParticipantI need some guidelines regarding a project.
What is the correct way of approach, when you need to update a value stored in localStorage during a click of a list-item which action is a “Go to Screen” one? -Neither don’t want to post a form between them nor a php web-server page-Because of the two .mobi screens, if I use the “Go to Screen” action, I cannot update the localstorage value through a function in _custom.js.
If I use the “Run Javascript” action, the 2nd screen is not available in the main screen, so I cannot use a phoneui.gotoScreen …All designing occurs in Design Center, so the only untouched file to tweak is the _custom.js one.
Thanks for your time guys.
PS. If this thread should be moved, please do. It’s my first post.
support-michaelKeymaster>Because of the two .mobi screens, if I use the “Go to Screen” action, I cannot update the localstorage value through a function in _custom.js
Sure you can use the <project>_custom.js file. There should only one _custom.js file in your project. Customize the specific stubbed function shown below with the side-effect to save/update storage as needed either before or after a screen transition.
/** * 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) { // add custom pre-transition code here // return false to terminate transition return true; } /** * Notification that the UI has transitioned to a new screen. * * @param {String} newScreenId */ phoneui.postPageTransition = function(newScreenId) { }
epetParticipantYes, I see. Thank you very much for your quick reply.
And, to catch the caller object of the page transition (and its properties like name etc), I have to use something like $(event.srcElement) ?
support-octavioMemberHi timiman,
Yes, I believe that will work. Can I ask why you need to know the UI object that initiated the transition? My interest is to better understand if there may be some complexity here as some widgets such as selectLists and combos are implemented with separate UI and model components.
epetParticipantBasically it has to do with a dynamic created rounded list, which items call the same function. Because of the same function called by a number of items, the need to distinguish which the caller is, is a must for later use.
-
AuthorPosts