显示包含大量字段的组时 Orbeon 页面渲染速度缓慢
我正在处理 Orbeon 表单,并且有一个与性能相关的问题,如下所述。
我有一个表格,最初有五个字段。在第五个下拉字段中,如果我选择“是”,由于 xforms:group
它会显示一个字段块(该块大约有 40 个字段)。 由于该块位于重复部分,因此我可以添加/删除尽可能多的块。
现在,如果我添加 10 个块,并且当我将第五个下拉字段从任意值切换为“是”时,则需要 2 秒多的时间才能显示所有块。
我在具有 2GB RAM 的 Windows XP 桌面上使用 Orbeon Forms 3.8 和 Tomcat 6。
请让我知道选择“是”时会发生什么(意味着 xforms:group 为 true 时的条件显示),这会花费更多时间来显示。
<xforms:group ref=".[instance('form-attributes')/flag='yes']" >
//code for the controls here
</xforms:group>
I am working on Orbeon forms and i have a performance related issue as explained below.
I have a form where I have five fields initially. On the fifth dropdown field, if I select "Yes", because of xforms:group
it shows a block of fields (the block has around 40 fields).
Since the block is in the repeated section, I can add/delete as many blocks as I can.
Now, if I add say 10 blocks and when I toggle the fifth dropdown field from any value to "Yes", it takes more than 2 seconds to display all the blocks.
I am using Orbeon Forms 3.8 and Tomcat 6 on Windows XP desktop with 2GB RAM.
Please let me know what happens when "Yes" is selected (meaning conditional display when xforms:group is true) which is taking more time to display.
<xforms:group ref=".[instance('form-attributes')/flag='yes']" >
//code for the controls here
</xforms:group>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
如果您使用的代码如下所示:
condition
为 false 时,组内的字段不相关。 XForms 引擎不会计算它们的值、只读状态、有效性、标签、提示、帮助、警报等。condition
变为 true 时,组的内容变得相关,并且 XForms引擎评估组内的所有控件。通常,步骤 #2 比步骤 #3 快得多,特别是对于 IE7。为了避免步骤 #3 中的大量更新,编写此代码的另一种方法是:
这样,
div
内的字段将始终相关:condition
变为 true 时,浏览器可能需要做的就是翻转div
上的该类。它不一定需要更新内部的所有控件,除非它们的值也发生了变化。condition
为 false 时,服务器上的 XForms 引擎需要使div
内的所有控件保持最新。但通常情况下,尤其是当您看到 IE7 速度缓慢时,您在客户端上获得的性能远远超过了服务器上可能需要的增加的处理量。
If you are using code that looks like:
condition
is false, the fields inside the group are non-relevant. The XForms engine doesn't compute their value, read-only status, validity, label, hint, help, alert, etc.condition
becomes true, the content of the group become relevant, and the XForms engine evaluates all the controls inside the group.Typically, step #2 is much faster than #3, especially with IE7. To avoid the numerous updates on step #3, another way to write this code is:
With this, the fields inside the
div
will always be relevant:condition
becomes true, all the browser might need to do is to flip that class on thediv
. It won't necessarily need to update all the controls inside, unless of course their value has also changed.condition
is false, the XForms engine, on the server, needs to keep all the controls inside thediv
up-to-date.But more often than not, especially when you're seeing IE7 slowness, the performance you gain on the client far outweighs the increased processing that might be needed on the server.
我发现这个 链接似乎建议使用
span
标签而不是div
标签,尽管原始的帖子是关于代码崩溃的,当我在 IE 中测试它时,建议的解决方法在我的表单中提供了小的性能改进。希望这段代码能给您带来一些好处。I found this link that seems to suggest
span
tag instead ofdiv
tag, though the original post was for Code crash, the suggested work around gave a small performance improvement in my form when I tested it in IE. Hope this code will give you some benefit.