简体   繁体   English

剑道 ui kendoSortable 不工作

[英]Kendo ui kendoSortable not working

I'm using kendo ui to create some grids.我正在使用 kendo ui 创建一些网格。 The code example bellow is the one that drived me into my implementation.下面的代码示例是促使我进行实现的代码示例。 I faced a bug during the development and I tried some workarounds but none of them worked.我在开发过程中遇到了一个错误,我尝试了一些解决方法,但都没有奏效。

http://dojo.telerik.com/AsUDo/14 http://dojo.telerik.com/AsUDo/14

Here's the problem: I need to create a grid with sortable behaviour (in the whole tr).问题是:我需要创建一个具有可排序行为的网格(在整个 tr 中)。

The whole line gets sortable only when I comment this line:只有当我评论这一行时,整行才可以排序:

//ignore: "TD, input". 

But then if I change the Product Name and then click in Unit Price, for instance, the text in the Product Name field is set to the previous value.但是,如果我更改产品名称,然后单击单价,例如,产品名称字段中的文本将设置为以前的值。 It just doesn't get updated.它只是没有得到更新。

If I use the如果我使用

ignore: "TD, input" 

attribute though, the fields get updated whenever I type the Product Name and then change the Unit price or change any other field, but the only sortable column I get is the one with the template and that doesn't meet the requirement that my client asked.属性,每当我输入产品名称然后更改单价或更改任何其他字段时,字段都会更新,但我获得的唯一可排序列是带有模板的列,并且不符合我的客户要求的要求.

Any thoughts?有什么想法吗?

The sortable mousedown interferes with the cell save order of events, so when you edit the row and click off to another cell, the sortable events "kill" the editing events and your change is lost.可排序的 mousedown 会干扰事件的单元格保存顺序,因此当您编辑该行并单击另一个单元格时,可排序的事件会“杀死”编辑事件并且您的更改将丢失。

If you change your sortable filter to如果您将可排序过滤器更改为

filter: ">tbody >tr:not(.k-grid-edit-row)",

This "disables" the sortable events on the currently edited row so that the editing events can complete.这将“禁用”当前编辑行上的可排序事件,以便编辑事件可以完成。

The downside is that if you want to sort/drag the row being edited, you must first click off the row(so that it is no longer the .k-grid-edit-row) and then go back and drag that row.缺点是,如果要对正在编辑的行进行排序/拖动,则必须先单击该行(使其不再是 .k-grid-edit-row),然后返回并拖动该行。

This is how I have my sortable grids set up and I just live with the downside...or you live with using a sort handler instead of allowing the whole row to be dragged.这就是我设置可排序网格的方式,我只是忍受缺点……或者您忍受使用排序处理程序而不是允许拖动整行。

You may be able to play around with the filter to overcome my downside, but I have not been able to and in the grand scheme of things, there are more important things to spend time on...ie try to get the client to relax the not-that-important requirement.你也许可以玩弄过滤器来克服我的缺点,但我没能做到,而且在大局中,还有更重要的事情需要花时间......即尝试让客户放松不那么重要的要求。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM