ZK分组列表框性能
我目前正在使用 ZK 屏幕,其中包含包含组的列表框。由于您无法(据我所知)使用 DataBinder 通过 GroupsModel 设置模型,因此我手动创建一个模型并调用 setModel。要配置 Listgroups 和 Listitems,我需要创建一个 ListitemRenderer,我已经完成了。
问题是,每当您在屏幕上打开或关闭一个组时,它都会与服务器通信以将该组设置为打开状态,并为每个可见行再次调用 ListitemRenderer。这会导致用户界面滞后。
是否可以让 ZK 在客户端缓存 Listgroups 和 Listitems 的内容,以便打开/关闭组不会与服务器通信并且不会再次渲染每一行?使用此系统,行的内容将不会更改,直到用户执行另一次搜索或拖/放项目。
编辑: 我最终自己构建了 Listgroups 和 Listitems 并使用appendChild 添加它们。不需要模型或渲染器,因此一切都在客户端上完成,这意味着它非常快捷。不过,如果知道如何使用模型/渲染器来完成它,那就太好了。
I'm currently working on a ZK screen with a Listbox that contains groups. Since you can't (as far as I know) use DataBinder to set the model with a GroupsModel, I'm manually creating one and calling setModel. To configure the Listgroups and Listitems I need to create a ListitemRenderer, which I've done.
The problem is that whenever you open or close a group on the screen, it communicates with the server to set the group as being open, and calls the ListitemRenderer again for every visible row. This results in a laggy interface for the user.
Is it possible to get ZK to cache the contents of the Listgroups and Listitems on the client such that opening/closing groups will not talk to the server and doesn't render every row again? With this system, the contents of the rows will not change until the user performs another search, or if they drag/drop items.
Edit:
I ended up just building the Listgroups and Listitems myself and adding them with appendChild. No need for a model or renderer, so everything is done on the client meaning it's very snappy. It'd still be nice to know how it could be done with a model/renderer though.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我建议您可以使用 renderall() 方法。
例如
myListbox.getItemRenderer().renderAll()
IMO,如果您的模型包含大量数据,此操作可能会比默认操作慢。
I suggest you can use renderall() method.
e,g
myListbox.getItemRenderer().renderAll()
IMO, if your model contains a lot of data, this action will maybe slower than default action.