How to update Beans or Scoped Variables when transitioning in XPages Mobile Controls -


i'm having problem trying set values on mobile page before transition page.

i have scriptblock based on tony mcguckin's openntf xsnippet. http://openntf.org/xsnippets.nsf/snippet.xsp?id=calling-server-side-jscode-during-mobile-page-transitions

so when transition page id of "apppage3" call method "facilitycheckin" if json-rpc service.

i'm trying set value in viewscoped managed bean , testing trying set normal viewscope variable.

as best can tell mobile page not picking changes. it's not showing viewscope @ all. i'm not sure what's that. believe managed bean getting it's value it's page getting rendered first. value on mobile page blank first time , if either refresh, or exit , go page display. tried accessing bean via ssjs , el.

i need able set values mobile pages transition , out of page.

any advice appreciated.

thanks!!

i've updated code below show complete mobile page. i've not included custom control should displaying fields can if necessary.

i've created 6ish minute video demonstrating problem , shows relevant code.

http://traffic.libsyn.com/notesin9/so-question.mp4

thanks!!!

<xp:this.resources>     <xp:stylesheet href="/.ibmxspres/dojoroot/dijit/themes/tundra/tundra.css"></xp:stylesheet>     <xp:stylesheet href="/mobile.css"></xp:stylesheet> </xp:this.resources> <xc:ccdebugtoolbar defaultcollapsed="false"     collapseto="left"></xc:ccdebugtoolbar> <xe:singlepageapp id="singlepageapp1"     selectedpagename="home">     <xe:djxmheading id="djxmheading1" label="my inventory"></xe:djxmheading>       <xe:apppage id="homeid" pagename="home">         <xe:djxmheading id="djxmheading2" label="my inventory">         </xe:djxmheading>          <xc:mob_menu_home></xc:mob_menu_home>     </xe:apppage>      <xe:apppage id="apppage2" pagename="facility" resetcontent="true">         <xc:mob_menu_facility></xc:mob_menu_facility>     </xe:apppage>      <xe:apppage id="apppage8" pagename="show" resetcontent="true">         <xc:mob_menu_show></xc:mob_menu_show>     </xe:apppage>       <xe:apppage id="apppage3" pagename="facilitycheckin"         resetcontent="true">         <xc:mob_page_checkinout header="check in @ facility"             scantype="receiving" scanlocation="facility">         </xc:mob_page_checkinout>     </xe:apppage>      <xe:apppage id="apppage5" pagename="facilitycheckout"         resetcontent="true">         <xc:mob_page_checkinout header="check out facility"             scantype="shipping" scanlocation="facility">         </xc:mob_page_checkinout>     </xe:apppage>      <xe:apppage id="apppage6" pagename="showcheckout"         resetcontent="true">         <xc:mob_page_checkinout header="check out show"             scantype="shipping" scanlocation="show">         </xc:mob_page_checkinout>     </xe:apppage>      <xe:apppage id="apppage7" pagename="showcheckin"         resetcontent="true">         <xc:mob_page_checkinout header="check in @ show"             scantype="receiving" scanlocation="show">         </xc:mob_page_checkinout>     </xe:apppage>       <!-- sub pages -->      <!--  manifest page -->     <xe:apppage id="apppage4" pagename="manifest" resetcontent="true">         <xc:mob_page_manifest></xc:mob_page_manifest>     </xe:apppage>   </xe:singlepageapp>   <xe:jsonrpcservice id="jsonrpcservice1" servicename="appservice">     <xe:this.methods>          <xe:remotemethod name="setcurrentpage">             <xe:this.arguments>                 <xe:remotemethodarg name="pagename"></xe:remotemethodarg>                 <xe:remotemethodarg name="direction"></xe:remotemethodarg>             </xe:this.arguments>             <xe:this.script><![cdata[print("pagename " + pagename);             print("direction " + direction);             viewscope.put("vspage", "test"); app.setcurrentpage(pagename); app.setcurrentdirection(direction); return "";]]></xe:this.script>         </xe:remotemethod>     </xe:this.methods> </xe:jsonrpcservice> <xp:br></xp:br> <xp:br></xp:br> <xp:br></xp:br>  <xp:scriptblock id="scriptblock1">     <xp:this.value><![cdata[         xsp.addonload(function(){             // begin app page 1             var newpage = dijit.byid("#{id:apppage3}");              if(null != newpage){                 dojo.connect(newpage, "onbeforetransitionin", function(){                     var deferred = appservice.setcurrentpage("facilitycheckin", "onbeforetransitionin");                     deferred.addcallback(function(result) {                         console.log(result);                     });                 });                 dojo.connect(newpage, "onbeforetransitionout", function(){                     var deferred = appservice.setcurrentpage("facilitycheckin", "onbeforetransitionout");                     deferred.addcallback(function(result) {                         console.log(result);                     });                 });                 dojo.connect(newpage, "onaftertransitionin", function(){                     var deferred = appservice.setcurrentpage("facilitycheckin", "onaftertransitionin");                     deferred.addcallback(function(result) {                         console.log(result);                     });                 });                 dojo.connect(newpage, "onaftertransitionout", function(){                     var deferred =appservice.setcurrentpage("facilitycheckin", "onaftertransitionout");                     deferred.addcallback(function(result) {                         console.log(result);                     });                 });             }             // end app page 1              // begin home page              var newpage = dijit.byid("#{id:homeid}");              if(null != newpage){                 //console.log("inside home page")                 dojo.connect(newpage, "onbeforetransitionin", function(){                     var deferred = appservice.homepagereset();                     deferred.addcallback(function(result) {                         console.log(result);                     });                 });                 dojo.connect(newpage, "onbeforetransitionout", function(){                     var deferred = appservice.homepagereset();                     deferred.addcallback(function(result) {                         console.log(result);                     });                 });              }             // end home page          // insert new code above line         }); // ends block holds functions     ]]></xp:this.value> </xp:scriptblock> 

i faced similar problem time ago , had create xpage (with singleapplication) navigate instead of jumping apppage within same singleapplication.

not ideal, however, solved issue me since wanted able jump directly page in question (using qr code).. ;-)

/john

ps. follow findings here see if can done. kind of issues mobile controls (i had typeahead well) sort of pushed me in direction of other frameworks, now, anyway...


Comments