Slickgrid 列重新排序无法正常工作
我正在使用 Slickgrid javasript 库,并且我已经使用以下选项初始化了我的网格:
var options =
{
enableCellNavigation: true,
enableColumnReorder: true,
syncColumnCellResize: false,
asyncEditorLoading: true
};
我已经实现了 slickgrid 的其余部分,并且它工作得很好。我遇到的唯一问题是列重新排序无法正常工作。
我可以将列标题拖动到另一个位置,但是当它悬停在我想要放置它的位置时,其他列标题不会按照我之前看到的示例那样移动。我通常需要修改列标题,直到出现一个空格。
我还没有看到任何关于列标题无法重新排序的文档,所以我什至不知道在哪里,或者是什么可能导致这些问题。
有人对 Slickgrid 有类似的问题吗?或者有什么建议吗?
I am using the Slickgrid javasript library, and I have initialized my grid with the following options:
var options =
{
enableCellNavigation: true,
enableColumnReorder: true,
syncColumnCellResize: false,
asyncEditorLoading: true
};
I have the rest of my slickgrid implemented, and it is working great. The only issue I have experienced is that the column reordering is not working as it should.
I am able to drag a column header to another position, but when it hovers over where I would like to drop it, the other column headers are not shifting over as they should according to previous examples I have seen. I usually need to mess around with the column header until a space opens up.
I have not seen any documentation on column headers not being able to reorder, so I wouldn't even know where, or what might be causing these problems.
Does anybody have any similar problems such as these with Slickgrid, or any suggestions?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我最近刚刚开始使用 SlickGrid,遇到了类似的问题。
我是这样做的:
你可能会问我为什么这样做。好吧,我有一些来自动态内容的列标题,并试图以与行数据加载相同的方法加载内容。无论如何,当我以上述方式执行此操作时,其他所有内容(例如事件处理程序、行更新等)似乎都工作正常,除了您描述的奇怪的列重新排序行为之外。
经过多次尝试和错误并将我的代码与提供的示例进行比较后,事实证明我的错误是在初始化期间没有正确设置列。显然,当您使用空列数组调用 new Slick.Grid 时,会发生奇怪的行为。
我修复它的方法是简单地使用虚拟非空列数组初始化网格,然后仍然调用 setColumns 来设置实际列。例如,
在我进行了这一更改后,其他一切都按预期工作。
我花了一些时间才弄清楚,但我希望它对您或可能遇到类似问题的其他人有所帮助。
I'd just started using SlickGrid recently and I encountered a similar issue.
I was doing it in this way:
You might ask why I was doing it in that way. Well, I had some column headers from dynamic content and was trying to keep the content loading in the same method as my row data loading. In any case, everything else (e.g. event handlers, updating of rows, etc.) seemed to work fine when I did it in the above manner, except for the strange column reordering behavior that you described.
After much trial and error and comparing my code with the provided examples, it turns out my mistake was in not setting the columns properly during initialization. Apparently, the odd behavior occurs when you call new Slick.Grid with an empty columns array.
What I did to fix it was to simply initialize the grid with a dummy non-empty columns array and then still call setColumns later to set the actual columns. e.g.
Everything else worked as expected after I made this single change.
This took me a little while to figure out, but I hope it helps you or someone else who might have encountered a similar issue.