鼠标悬停时在 DataView 行中显示按钮 (ExtJS)
我想在 ExtJS 的 DataView 行中显示一个(删除)按钮。我不希望删除按钮始终可见,而只是在鼠标悬停时可见。
如果有人有一个例子,将不胜感激。
I would like to show a (delete) button in a DataView row in ExtJS. I don't want the delete button to be always visible but just on a mouseover.
If anyone has an example that would be greatly appreciated.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
附带说明一下,DataView 不一定有“行”。它具有您想要的任何内容,具体取决于为其提供的 XTemplate。
话虽如此,您可以将
overCls
配置选项添加到 DataView 中,当鼠标悬停在该类上时,该类将被添加到视图的项目中。然后,只需使用 CSS 根据 overCl 的存在来显示或隐藏删除按钮即可。然后在CSS中:
As a side note, a DataView doesn't necessarily have "rows". It has whatever you want it to have, depending on the XTemplate given to it.
Having said that, you can add the
overCls
config option to your DataView, and that class will be added to the view's items when the mouse hovers over it. Then it's just a matter of using CSS to show or hide the delete button based on the existence of the overCls.Then in CSS:
同样,如果您想在 GridPanel 中拥有相同的功能(已测试 v3.3),则可以通过对上述内容稍加修改来实现。
css 与上面指定的完全相同。
Similarly, if you want to have the same functionality in a GridPanel (v3.3 tested), it can be achieved with a slight variation on the above.
The css is exactly as specified above.