Jquery 如何通过拖放对剑道行重新排序
我想使用剑道的拖放功能对我的行重新排序,行是使用剑道生成的,我能够拖动,意味着我能够抓取一行,但是当我将它放在表中的某个位置时,行的位置不会改变,它保持不变。生成行的代码是Jquery 如何通过拖放对剑道行重新排序,jquery,kendo-ui,kendo-grid,Jquery,Kendo Ui,Kendo Grid,我想使用剑道的拖放功能对我的行重新排序,行是使用剑道生成的,我能够拖动,意味着我能够抓取一行,但是当我将它放在表中的某个位置时,行的位置不会改变,它保持不变。生成行的代码是 @(Html.Kendo().Grid < WorkItemsGrid > ().Name("workItemsGrid").Events(e => e.DataBound("onDataBound")) .Columns(c => { c.Bound(i => i.P
@(Html.Kendo().Grid < WorkItemsGrid > ().Name("workItemsGrid").Events(e => e.DataBound("onDataBound"))
.Columns(c => {
c.Bound(i => i.Priority).ClientTemplate("#= GetArrow(Priority)#");
c.Bound(i => i.Order);
c.Bound(i => i.EpicTitle).Title("Epic");
c.Bound(i => i.Type).ClientTemplate("#= GetType(Type)#");
c.Bound(i => i.Code).ClientTemplate("#= SetEdit(ItemsId, Code)#");
c.Bound(i => i.Title).ClientTemplate("#= length(Title)#");;
c.Bound(i => i.State);
c.Bound(i => i.Estimation).ClientTemplate("#= sum(Estimation)#");
c.Bound(i => i.ItemsId).HtmlAttributes(new {
@class = "rowId"
}).Hidden();
}).Scrollable().Reorderable(x => x.Columns(true))
.DataSource(d => d
.Ajax()
.Read(r => r.Action("Get", "Items", new {
projectId = ViewBag.projectId, selectedSprintId = ViewBag.selectedSprint
}))
)
);
@(Html.Kendo().Grid().Name(“WorkItemsGrid”).Events(e=>e.DataBound(“onDataBound”))
.列(c=>{
c、 绑定(i=>i.Priority);
c、 绑定(i=>i.顺序);
c、 绑定(i=>i.EpicTitle).Title(“Epic”);
c、 绑定(i=>i.Type).ClientTemplate(“#=GetType(Type)#”);
c、 绑定(i=>i.Code).ClientTemplate(#=SetEdit(ItemsId,Code)#);
c、 绑定(i=>i.Title).ClientTemplate(“#=长度(标题)#”);;
c、 绑定(i=>i.State);
c、 绑定(i=>i.Estimation).ClientTemplate(“#=sum(Estimation)#”);
c、 绑定(i=>i.ItemsId).HtmlAttributes(新{
@class=“rowId”
}).Hidden();
}).Scrollable().Reorderable(x=>x.Columns(true))
.DataSource(d=>d
.Ajax()
.Read(r=>r.Action(“获取”、“项目”),新建{
projectId=ViewBag.projectId,selectedSprintId=ViewBag.selectedSprint
}))
)
);
数据绑定Javascrip:
function onDataBound(e) {
var grid = this;
var currentRecords = grid.dataSource.view();
for (var i = 0; i < currentRecords.length; i++) {
if (!currentRecords[i].activeInd) {
var row = grid.tbody.find("tr[data-uid='" + currentRecords[i].uid + "']");
row.addClass("item-row");
row.draggable({
cursorAt: {
left: 75
},
containment: ".grid-view",
cursor: "-webkit-grabbing",
start: function() {
$(this).hide();
},
stop: function() {
$(this).show();
},
helper: function() {
return $('<div id="' + $(this).find(".rowId").html() + '" class="holder k-grid"><table></table></div>').find('table').append($(this).clone()).end().appendTo('body');
}
});
}
}
}
函数onDataBound(e){
var grid=此;
var currentRecords=grid.dataSource.view();
对于(var i=0;i
如何通过拖放行来更改顺序?
我是剑道新手,它以前是由一些其他开发人员生成的,今天不可用请查看此内容并参考。您可以将剑道UI可排序小部件与剑道UI网格集成。当网格处于单元格编辑模式时,上述剑道演示将出现问题-单击另一行时,对单元格的更改将丢失 这把小提琴有用 如上所述,它使用带有拖动手柄的列来防止单元格编辑丢失-其他单元格在设置中被忽略:
grid.table.kendoSortable({
filter: ">tbody >tr",
hint: $.noop,
cursor: "move",
ignore: "TD, input",
placeholder: function (element) {
return element.clone().addClass("k-state-hover").css("opacity", 0.65);
},
container: '#grid tbody',
change: onGridRowChange
});
它还更新数据源中的位置字段,而不是像其他一些示例中那样删除,然后重新插入该行-因为这将导致针对移动的每一行向服务器发出删除请求-这可能会在单击批量编辑取消按钮时引起问题。显示“位置”字段仅用于演示目的-不应为手动编辑而公开它。我需要在Vue中使用typescript进行同样的操作,这是可能的吗