简体   繁体   English

Kendo UI Grid Reorderable Rows 没有从下往上正确地重新排序

[英]Kendo UI Grid Reorderable Rows not reordering properly from bottom up

I have added the reorderable rows to true and when reordering by dragging and dropping a row, it doesn't work properly.我已将可重新排序的行添加为 true,当通过拖放行重新排序时,它无法正常工作。 If I was to move Room 4 and drop it above the 1st row, it doesn't go there, sometimes other rows will go where I drop them but not always.如果我要移动 4 号房间并将其放在第一行上方,它不会 go 放在那里,有时其他行会 go 我将它们放在那里但并非总是如此。

Here is a link to the demo Reorder Row Drag and Drop这是演示重新排序行拖放的链接

any idea's on why its not working properly?关于为什么它不能正常工作的任何想法?

 $(document).ready(() => { LoadRoomsGrid(); }); function LoadRoomsGrid() { $("#RoomsGrid").empty(); $("#RoomsGrid").kendoGrid({ dataSource: { data: roomData }, dataBound: (e) => { }, schema: { model: { id: "RoomID", fields: { RoomID: { editable: false, hidden: true }, roomName: { editable: true, type: "string", hidden: false } } } }, columns: [{ field: "RoomID", title: "RoomID", hidden: true }, { field: "RoomName", title: "Rooms" } ], noRecords: { template: "No Rooms" }, reorderable: { rows: true }, change: function(e) {} }); } const roomData = [{ RoomID: 1, RoomName: "Room 1" }, { RoomID: 2, RoomName: "Room 2" }, { RoomID: 3, RoomName: "Room 3" }, { RoomID: 4, RoomName: "Room 4" } ]
 <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script> <script src="https://kendo.cdn.telerik.com/2022.3.1109/js/kendo.all.min.js"></script> <link rel="stylesheet" href="https://kendo.cdn.telerik.com/2022.3.1109/styles/kendo.default-ocean-blue.min.css"> <div id="RoomsGrid"></div>

It would appear that each item in the datasource must have a unique 'id' property for row reordering to work, even though that is not explicitly stated in the documentation.看起来数据源中的每个项目都必须具有唯一的“id”属性才能使行重新排序起作用,即使文档中没有明确说明也是如此。

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

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