SlickGrid 单元格样式在排序时丢失
当对 SlickGrid 中的行进行排序时,它们似乎都被销毁并重新创建,从而丢失了可能在运行时添加的 CSS 类。
例如,我希望“脏”行(即已编辑但尚未保存)((我不自动提交,但使用网格上的“保存”按钮来保存数据))以不同方式显示,特别显示“脏”图标。
因此,当一行“脏”时,它的一个单元格(图标列)将获得一个 CSS 类来显示正确的图标。然而,当对行进行排序时,这一点就会丢失。有没有办法避免在排序时创建全新的行?或者用不同的方法来完成这个任务?
谢谢!
When sorting the rows in SlickGrid, it seems that they are all destroyed and recreated, thus losing the CSS classes that may have been added at run-time.
For example, I want rows that are "dirty" (that is, have been edited but not yet saved)((I don't auto-commit, but use a Save button on the grid to persist data)) to display differently, specifically displaying a "dirty" icon.
So, when a row is "dirty", one of its cells (an icon column) gains a CSS class to display the proper icon. This however is then lost when rows are sorted. Is there a way to avoid the creation of brand new rows on a sort? Or a different method to accomplish this task?
Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
SlickGrid 明确禁止直接操作它创建的 DOM 元素(编辑器除外)。如果您需要使用 CSS 类装饰单元格/行,请使用 SlickGrid 提供的 API(自定义格式化程序、行/单元格元数据、addCellCssStyles 等)。这样,它们将在重新渲染时持续存在。
SlickGrid explicitly forbids direct manipulation of the DOM elements it creates with the exception of editors. If you need to decorate a cell/row with a CSS class, do so using the APIs provided by SlickGrid (custom formatters, row/cell metadata, addCellCssStyles, etc.). That way, they will persist across re-renders.