Я собираюсь реализовать поведение перетаскивания с сеткой кендо, которая заполняется с использованием шаблона. Как я могу достичь перетаскиваемых строк и переупорядочить сетку кендо.Kendo Grid Draggable Rows With Kendo Template
0
A
ответ
0
.Orderable()
Работы по обработке. Может быть, попробуйте «.Dragable()« Я немного не уверен в этом.
0
Взгляните на мой демонстрационный код и попробуйте его реализовать.
var data = [
{ id: 1, text: "text 1", position: 0 },
{ id: 2, text: "text 2", position: 1 },
{ id: 3, text: "text 3", position: 2 }
]
var dataSource = new kendo.data.DataSource({
data: data,
schema: {
model: {
id: "id",
fields: {
id: { type: "number" },
text: { type: "string" },
position: { type: "number" }
}
}
}
});
var grid = $("#grid").kendoGrid({
dataSource: dataSource,
scrollable: false,
columns: ["id", "text", "position"]
}).data("kendoGrid");
grid.table.kendoDraggable({
filter: "tbody > tr",
group: "gridGroup",
hint: function(e) {
return $('<div class="k-grid k-widget"><table><tbody><tr>' + e.html() + '</tr></tbody></table></div>');
}
});
grid.table/*.find("tbody > tr")*/.kendoDropTarget({
group: "gridGroup",
drop: function(e) {
var target = dataSource.get($(e.draggable.currentTarget).data("id")),
dest = $(e.target);
if (dest.is("th")) {
return;
}
dest = dataSource.get(dest.parent().data("id"));
//not on same item
if (target.get("id") !== dest.get("id")) {
//reorder the items
var tmp = target.get("position");
target.set("position", dest.get("position"));
dest.set("position", tmp);
dataSource.sort({ field: "position", dir: "asc" });
}
}
});
0
поставил .Dragable() , но убедитесь, что вы сидите его в нужном месте, требуется упорядочение. Иногда вы не можете получить ожидаемый результат, и это может произойти из-за того, что вы не обратили внимание на заказ.
Смежные вопросы
- 1. Invalid Template - Kendo Grid
- 2. Kendo Grid Client Template with Condition
- 3. Kendo UI Grid Row Template
- 4. Kendo-Grid with Angular
- 5. Kendo Template Invalid in Grid
- 6. Kendo Grid Foreign Key template
- 7. Knockout kendo grid template binding
- 8. Kendo Grid Excel Export with Columns with DropDown Template
- 9. select unselect rows of kendo UI Grid with checkbox
- 10. Kendo Grid with AngularJS Binding
- 11. Kendo Grid Popup with Tabstrip
- 12. Kendo Grid ServerFiltering with MultiSelect
- 13. Kendo Datepicker внутри панели теней Kendo Grid - Invalid Template
- 14. kendo mvc grid editor template with checkbox list
- 15. Kendo Grid with Kendo Dropdownlist Выбранное значение не обновлено
- 16. Kendo Window with Grid показывает пустую сетку
- 17. Kendo Listview + Kendo DataSource + Template
- 18. For Loop in Kendo Grid Template
- 19. Kendo UI Grid, Uncaught Error: Invalid Template
- 20. Kendo UI Grid Hierarchy Invalid Template
- 21. Kendo UI Grid Row Template Command
- 22. Kendo Grid DropdownList And Insert template Ошибка
- 23. Kendo Grid В сетке Kendo
- 24. Kendo Grid Фильтрующая ячейка
- 25. Kendo UI Template refresh
- 26. Kendo Grid Search ParameterMap
- 27. Kendo UI Grid with divlect ID translation
- 28. Kendo UI Grid Failed with Mono
- 29. Kendo grid with dropdown action command
- 30. kendo ui grid with stacked columns
привет там .... –