onRendered 回调
我需要实现一个 onRendered()
事件,以确保在执行操作之前渲染所有网格,即 .hide()
它。我的目标是将 .hide()
和 .show()
按钮附加到网格所在的 div
上,并具有默认状态设置为隐藏。问题是,在 my 脚本执行初始 .hide()
时,grid.js 脚本尚未完全创建网格。我宁愿不做任何延迟循环。更确切地说有一个回调。
任何帮助将不胜感激
谢谢 拍
I need to implement a sought of onRendered()
event that would ensure all of the grid is rendered before I do something, which is to .hide()
it. My gaol is to have a .hide()
and .show()
button attached to the div
the grid resides in, with the default status set at hidden. The problem is that at the point in which my script executes the initial .hide()
, the grid is not fully created yet by the grid.js script. I would rather not do any delay loop. Much rather have a callback.
Any help would be appreciated
Thanks
Pat
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
这应该可以在没有回调的情况下工作。我有一个 SlickGrid 应用程序,我可以在其中显示和隐藏网格以响应 UI 事件。网格在实例化后立即存在(使用
new Slick.Grid
),并且可以使用.hide()
和.show()方法。
不过,我确实发现了一个问题...
如果您使用
display: none
创建div
标记(因此它最初是隐藏的),则网格列不会正确初始化。为了解决这个问题,我使用visibility:hidden
创建 div 标签,并在使用.hide()
和.show()
方法之前删除此样式。我的代码大致如下所示:
希望这有帮助。
This should work without a callback. I have a SlickGrid app where I show and hide the grid in response to UI events. The grid exists as soon as it is instantiated (with
new Slick.Grid
) and can be manipulated with the.hide()
and.show()
methods.I did find one catch though...
If you create the
div
tag withdisplay: none
(so it is initially hidden) the grid columns do not initialise properly. To workaround this I create the div tag withvisibility: hidden
and remove this style before using the.hide()
and.show()
methods.My code looks roughly like this:
Hope this helps.
slick grid 实现了一个 onRendered 事件 github 源码。我们可以订阅此事件并适当利用它。
The slick grid has implemented an event onRendered event github source. We can subscribe to this event and make the appropriate use of it.