Hi, the solution here is to enable partial execution (in Designer, the Events view, check-box "Set partial execution mode")
which updates the xp:eventHandler tag with execMode="partial"
And to verify that the xsp.properties file in the application contains
xsp.ajax.renderwholetree=false
That option is present by default in applications created in Domino Designer 8.5.2 or later - you can set it manually in 8.5.1.
[For more on the renderwholetree option see the XPages Portable Command Guide which has a detailed discussion.]
So the example provided becomes like so:
Updated Source
<?xml version="1.0" encoding="UTF-8"?>
<xp:view xmlns:xp="http://www.ibm.com/xsp/core">
PHAN8RPL3D Updated sample<xp:br/>
With execMode="partial"<xp:br/>
and xsp.properties option <xp:br/>
xsp.ajax.renderwholetree=false<xp:br/>
the problem does not occur - clicking the button <xp:br/>
does not give the print statement from col2 on the server console.<xp:br/>
<xp:button value="Refresh Table Column 1" id="button1">
<xp:eventHandler event="onclick" submit="true"
refreshMode="partial" refreshId="col1" execMode="partial" />
</xp:button>
<xp:table border="1">
<xp:tr>
<xp:td id="col1" style="border:solid blue thin">
<xp:text escape="true" id="computedField2" value="#{javascript:@Now()}">
<xp:this.converter>
<xp:convertDateTime type="both" />
</xp:this.converter>
</xp:text>
</xp:td>
<xp:td id="col2" style="border:solid blue thin">
<xp:text escape="true" id="computedField1" value="#{javascript:@Now()}">
<xp:this.converter>
<xp:convertDateTime type="both" />
</xp:this.converter>
</xp:text>
<xp:dataTable id="dataTable1" rows="30">
<xp:this.value><![CDATA[#{javascript:
print('You shall not refresh');
}]]></xp:this.value>
<xp:column id="column1">
</xp:column>
</xp:dataTable>
</xp:td>
</xp:tr>
</xp:table>
</xp:view>
To explain what's going on there involves a discussion of the JSF lifecycle and the restricted lifecycle(s) used in partial update requests.
A partial update (like a full page submission) is a sequence of phases. The values of input controls in the browser are posted to the server,
then on the server the server-side control tree is restored, the posted values are applied to temporary locations,
values are validated using the validators and converters, values are saved to the document fields,
then the event action is executed, the control tree is rendered to HTML (computing any values as needed),
the response is received in the browser, and (for partial update) the old HTML content is removed and the new HTML content is inserted.
For a full page submission each of the server-side phases is executed over all the controls in sequence,
so all of the controls save values to temporary locations, then all of the controls validate, then all of the values are saved, etc.
For a partial update submission, the phases do occur in sequence, but some phases only apply to the subset of controls indicated by the refreshId,
some phases apply to all the controls, and some phases only apply to the subset of controls indicated by the execId.
The exact behavior depends on how the partial update submission is configured in the Event Handler for the control,
the xsp.properties options for the application (and in any Dynamic Content control in the XPage).
For the early phases - copy posted values, validate, save to document fields -
which controls are processed depends on the execMode property in the Event Handler
(i.e. the "Set partial execution mode" checkbox in the Events tab in Designer).
When the execMode property is absent, the early phases will process all of the controls in the tree.
[So why would the print statement only appear once instead of for each phase? Any data
that's evaluated is cached through the early phases and the execute action phase,
and the cache is cleared before the final render, so that any changes to the data are read from the NSF layer.]
When the execMode property is present (execMode="partial"), then the early phases are restricted to the control area specified
by the execId property. If you haven't configured the execId for the Event Handler, then by default the execId will be the Button
(or whatever control is the Event Handler's parent). To find the control for the execId
it does an "invokeOnComponent" search through the control tree, which will publish container data sources of the control area
and xp:panel data sources, but won't publish dataTable or viewPanel data sources, nor data sources in irrelevant Custom Controls.
The execute event action phase always applies to a single control - the Event Handler.
The final phase of HTML generation is not effected by the execMode property,
only by the refreshId and by the renderwholetree option mentioned above.
When renderwholetree=false, the phase does an "invokeOnComponent" search for the refreshId control,
then it renders the HTML for that control and its children (and the Script Collector for the page) and returns the HTML to the browser.
So the original server-side behavior was;
1. Restore control tree. 2. Apply posted values for all controls,
including iterating through the dataTable control multiple times, for each of the rows being displayed in the datatable.
That phase will compute and cache any data sources encountered.
That's where the print statement was output.
3. Validate all controls, including iterating through the dataTable multiple times.
4. Save all values, including iterating through the dataTable multiple times.
5. Execute the Event Handler control.
6. In the render phase, do an "invokeOnContainer" search for the refreshId control, render the control to generate the HTML.
The new server-side behavior with execMode=partial is:
1. Restore the control tree. 2. Apply posted values to the execId area (using an "invokeOnContainer" search to find that control).
3. Validate the execId area (another "invokeOnContainer" search),
4. Save values in the execId area (another "invokeOnContainer" search),
5. Execute the Event Handler control.
6. In the render phase, do an "invokeOnContainer" search for the refreshId control, render the control to generate the HTML.
Let us know if there are still problems with that setting enabled.