Apache Wicket – 在 RepeatingView 上使用 HTML5-details 元素 – 保存 open 属性

huangapple go评论99阅读模式
英文:

Apache Wicket - HTML5-details-element on Repeatingview - save open-property

问题

我有一个包含HTML5详细元素的重复视图。用户可以打开或折叠一些元素。如果我从重复视图中删除一些元素,然后通过target.add(container)重新加载重复视图,所有元素都会再次折叠。我该如何解决这个问题?是否有一种简单的方法来存储展开属性?

英文:

I have a repeatingview which contains HTML5 detail elements. The user can open or collapse some elements. If I remove some elements of the repeatingview and then reload the repeatingview by target.add(container), all elements are collapsed again. How can I solve this? Is there a simple way to store the open-Property?

答案1

得分: 2

当一个<detail>元素被展示时,会向其添加一个open属性。

您将需要将该状态持久化在某个地方:可以是在浏览器中(例如在cookie中或者直接在页面上的某些JS中),或者将其发送到服务器,这样Wicket可以渲染出这些open属性。

英文:

When a &lt;detail&gt; element is revealed, an open attribute is added to it.

You will have to persist that state somewhere: in the browser (e.g. in a cookie or just in some JS on that page) or send it to the server so Wicket can render the open attributes.

答案2

得分: 0

如果您在AjaxRequestTarget中添加了RepeatingView,但没有覆盖RepeatingView对象的onConfigure()方法,它将会重绘并呈现为第一次。请提供一些代码,以便我们可以查看问题发生的上下文。

英文:

If you are adding the RepeatingView in an AjaxRequestTarget but you are not overriding onConfigure() method of RepeatingView object, it will repaint and render as the first time it did.

Could you please provide some code so we can see in which context the issue is happening?

huangapple
  • 本文由 发表于 2020年7月24日 05:42:37
  • 转载请务必保留本文链接:https://go.coder-hub.com/63063540.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定