repeater - XPages Managed Bean and Repeat Control issue: how to reload value? -


for xpage developed managed beans keep data. page contains repeat control, it's @ moment:

<xp:panel styleclass="form">     <xp:this.datacontexts>         <xp:datacontext value="#{javascript:pagedata.getform(compositedata.formname, compositedata.datasource);}"             var="myformdata">         </xp:datacontext>         <xp:datacontext var="myfields">             <xp:this.value><![cdata[#{javascript:return myformdata.getfieldsasjson();}]]></xp:this.value>         </xp:datacontext>     </xp:this.datacontexts>     <xp:table style="width:100%" cellspacing="1" cellpadding="0">         <xp:repeat var="thisfield" rows="#{javascript:compositedata.rows}" disabletheme="true" repeatcontrols="true"             disableoutputtag="true" value="#{myfields}"> 

the pagedata object bean, contains info form , fields. dropdown fields contain options, can dynamically created. when happens, result of partial refresh, form redisplayed but... repeat 'value' (myfields) isn't reloaded repeat, new dropdown options aren't made available.

how can make xpages reload 'value' property?

update more info, requested...

from formdata bean:

public object getfieldsasjson() {     arrayobject list = null;      try {         system.err.print("formdata: getfieldsasjson");         list = new arrayobject();         (entry<string, fielddata> e : fields.entryset()) {             fielddata field = e.getvalue();             list.addarrayvalue(field.getjson());         }      } catch (exception e) {      }     return list; } 

and fielddata bean:

public objectobject getjson() throws interpretexception {     objectobject json = new objectobject();     json.put("name", fbsutility.wrap(name));     json.put("label", fbsutility.wrap(field.getlabel()));     json.put("options", fbsutility.wrap(values));     return json; } 

imho problem isn't in these beans. it's more xpages issue, because strange reason structure fetched once, , never again. apparently, xpages considers json static, isn't.

before bean-era, had in ssjs, creating javascript object on fly, , reloaded every time. why not anymore, difference? there tell xpages repeat-value 'stale' , should re-read?

with current code myformdata , myfields recalculated during every partial refresh well. necessary?

i'm not certain, looking @ you're seeing, suspect repeat control needs contents of datacontexts @ particular phase of xpages lifecycle. datacontexts recalculated @ every phase of xpages lifecycle, may result in them being null when repeat wants use values.

my best advice debug what's happening @ phases in partial refresh. you'll need change code work around what's calculated when.

i'm not convinced datacontexts set computed dynamically approach unless you're using them rendered properties or read-only data. if you're using managed bean, lazy-loading data , retrieving directly bean may better approach, making easier identify when it's being called.


Comments

Popular posts from this blog

java - Plugin org.apache.maven.plugins:maven-install-plugin:2.4 or one of its dependencies could not be resolved -

Round ImageView Android -

How can I utilize Yahoo Weather API in android -