在 Sven 的博客上 http://hasselba.ch/blog/?p=1383他发表了一篇关于优化部分刷新的精彩文章。我尝试发布以下问题,但它一直说它是垃圾邮件。所以我想我应该来这里问问。他发布的代码是:
<xp:button
value="Cleaned Refresh"
id="buttonCleaned">
<xp:eventHandler
event="onclick"
submit="false">
<xp:this.script>
<![CDATA[
XSP.partialRefreshPost(
'#{id:refreshMe}',{
clearForm: true,
}
);]]>
</xp:this.script>
</xp:eventHandler>
</xp:button>
“clearForm : true”行有什么作用,我没有在任何地方看到它被引用? 我在 onCompleted 事件中使用partialRefreshPost 来刷新其他字段,从我在这段代码中看到的内容来看,您不会在事件上使用部分刷新属性,而是将此代码添加到 onClick 事件中。您是在所有情况下都这样做还是只是在特殊情况下这样做?例如,在一个页面上,我在 5 或 6 个不同字段上有一个 onChange 事件,该事件对 id 进行部分刷新,页面上有 30 多个字段,因此该页面看起来所做的事情比实际需要的要多得多。
最佳答案
紧邻链接中示例代码的上方,
The optimized version adds the option
clearForm
to partial refreshs. When using this option, only the XPages internal fields are sent to the server, but DOM will be refreshed correctly:
关于javascript - 优化部分刷新,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25936904/