I have a document data source (create document with no parent id) bound to a panel. Within the panel I have 2 other panels. On completing the fields in panel 1 I click a lin
Here is a example how you can add a new datasource with a partial refresh:
<xp:panel id="myPanel">
<xp:this.data>
<xp:dominoDocument var="document1"></xp:dominoDocument>
</xp:this.data>
<xp:br></xp:br>
<xp:inputText id="inputText1" value="#{document1.Test}"></xp:inputText>
<xp:br></xp:br>
<xp:br></xp:br>
<xp:button value="Save" id="buttonSave">
<xp:eventHandler event="onclick" submit="true"
refreshMode="partial" refreshId="myPanel">
<xp:this.action>
<xp:actionGroup>
<xp:saveDocument var="document1"></xp:saveDocument>
<xp:executeScript>
<xp:this.script>
<![CDATA[#{javascript:
var panel = getComponent("myPanel");
var ds = new com.ibm.xsp.model.domino.DominoDocumentData();
ds.setComponent(panel);
ds.setVar("document1");
panel.getData().clear();
panel.addData(ds);
}]]>
</xp:this.script>
</xp:executeScript>
</xp:actionGroup>
</xp:this.action>
</xp:eventHandler>
</xp:button>
</xp:panel>
Hope this helps
Sven
EDIT:
Added a clear() to remove all previous defined datasources from the panel.
I used Sven's answer succesfully, however, I had to add an extra line in ths server side JavaScript
<xp:executeScript>
<xp:this.script>
<![CDATA[#{javascript:
var panel = getComponent("myPanel");
var ds = new com.ibm.xsp.model.domino.DominoDocumentData();
ds.setComponent(panel);
ds.setVar("document1");
ds.setFormName('form1');
panel.getData().clear();
panel.addData(ds);
}]]>
</xp:this.script>
</xp:executeScript>
That's default behaviour. If you don't want to reload the whole page one option is to get rid of the datasource and create the new doc in SSJS event when Save button is clicked.