For my XPage I developed some Managed Beans to keep data. The page itself contains a Repeat control, it's like this at the 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 is a bean, it contains info about a form and its fields. The dropdown fields contain options, but they can be dynamically created. When that happens, as a result of a partial refresh, the form is redisplayed but... the repeat 'value' itself (myFields) isn't reloaded into the repeat, so new dropdown options aren't made available.
How can I make XPages reload the 'value' property?
UPDATE More info, as requested...
From the FormData bean:
public Object getFieldsAsJSON() {
ArrayObject list = null;
try {
System.err.print("FormData: getFieldsAsJSON");
list = new ArrayObject();
for (Entry<String, FieldData> e : fields.entrySet()) {
FieldData field = e.getValue();
list.addArrayValue(field.getJSON());
}
} catch (Exception e) {
}
return list;
}
and from the 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 the problem isn't in these beans. It's more an XPages issue, because for some strange reason the structure is only fetched once, and never again. Apparently, XPages considers the json to be static, which it isn't.
Before the bean-era, I had everything in SSJS, creating the JavaScript object on the fly, and it was reloaded every time. Why not anymore, what is the difference? Is there something to tell XPages that the repeat-value is 'stale' and should be re-read?