组的替代函数,以提高 xfrom 的性能
我们可以使用 group 之外的替代函数来执行相同的操作吗?我尝试使用组进行锻炼的场景是 - 我在一个表单中有多个页面,并且第一页上有一个摘要按钮,单击该按钮后应显示所有页面的摘要。
我们尝试的逻辑是使用组通过一个表单变量来组合每个单独的页面,当单击摘要按钮时该变量变为 true,并且我们在所有页面中检查此变量值,因此当单击摘要按钮时此条件满足并且所有页面显示。
使用 group fn 的代码片段
<Xforms:group id="page-1"
ref=".[instance('form')/current-page = '1'
or
instance('form')/summary = 'true']">
会大大降低性能。有没有什么方法可以执行相同的场景。请指教。
Can we use an alternate function other than group to perform the same action. The scenario I am trying to workout using group is - I have multiple pages in a form and a summary button on the first page which on being clicked should show the summary of all pages.
The logic we tried was using group to club each individual pages by having a form variable which turns true when the summary button is clicked and we check this variables value in all pages and so when the summary button is clicked this condition satisfies and all the pages are displayed.
The Code Snippet
<Xforms:group id="page-1"
ref=".[instance('form')/current-page = '1'
or
instance('form')/summary = 'true']">
Using group fn drastically depreciates the performance. Is there any method to perform the same scenario. Kindly advise.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
此时,隐藏组和隐藏案例的工作方式不同:
因此,使用 switch/case,服务器必须做更多的工作来维护和更新隐藏 case 中的控件状态,但切换到另一个 case 非常快:这几乎只是更改类的问题在 HTML 中,因为所有控件的值都已经存在。对于隐藏组,当“切换到另一个组”时,该组中的控件的值将由服务器发送到浏览器。更新值可能需要一点时间,特别是如果您有很多控件(例如重复)。
在不真正运行代码的情况下很难给出建议,但是如果进行切换所需的时间主要花在浏览器上,您可以使用 完整更新机制。如果时间主要花在服务器上,那么我会研究 XPath 分析。 (请注意,这两个功能仅限 PE。)
At this point, hidden groups and hidden cases work differently:
As a result, using a switch/case, the server has to do more work to maintain and update the state of controls in hidden cases, but switching to a another case is very fast: it is pretty much just a matter of changing a class in the HTML, as the values of all the controls are already there. With hidden groups, when "switching to another group", the values for the controls in that group are sent by the server to the browser. Updating the values can take a little bit of time, especially if you have a lot of controls, say in a repeat.
It is hard to give a recommendation without really running your code, but if the time taken to do a switch is mostly spent on the browser, you could investigate using the full update mechanism. If the time is mostly spent on the server, then I'd look into XPath analysis. (Note that both features are PE-only.)