对行进行排序后,Ag-grid 拖放不起作用 [英] Ag-grid drag and drop doesn't work after sorting rows

查看:21
本文介绍了对行进行排序后,Ag-grid 拖放不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在 Ag-grid-react 上对我的行进行排序后,拖放停止工作.在排序之前,拖放已全部设置并运行良好.

After sorting my rows on Ag-grid-react, drag and drop stops working. Before sorting, drag and drop is all set and working well.

postSort API 似乎没有实现我需要的东西,重置行甚至设置可拖动就像选择一样.

postSort API does not seem to have something to achieve what I need, reset the row or even set draggable just like for selection.

postSort={nodes => nodes.forEach(n => n.setRowSelectable(true))}

我也试过使用

postSort={nodes => nodes.forEach(n => n.setDragging(true))}

但这实际上会开始拖动所有行

but that would actually start the dragging for all the rows instead

我希望在对它们进行排序后单击行时拖放继续工作.提前致谢!

I want the drag and drop to keep working when row is clicked after sorting them. Thanks in advance!

推荐答案

我找到了一个对我有用的解决方案.如果您面临类似的问题,即您想在排序后启用拖动,则需要像这样禁用排序:

I found a solution that worked for me. if you are facing a similar issue where you want to enable drag after a sort you need to disable the sort like this:

gridColumnApi.applyColumnState({ defaultState: { sort: null } });

gridColumnApi.applyColumnState({ defaultState: { sort: null } });

这会将拖放操作带回到排序之前的列.

this will bring back the drag&drop to the columns you had it prior to the sort.

仍在尝试找到一种方法来告诉网格重新组织其索引,以便我们可以保持排序并同时启用拖动.

Still trying to find a way to tell the grid to reorganize its indexes so we can keep the sort and enable the drag at the same time.

这篇关于对行进行排序后,Ag-grid 拖放不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆