jQuery UI 对具有 rowspan 的表的 sortable()
jQuery UI's sortable() for Tables with rowspan
有没有办法让 jQuery UI 的 sortable() 仅根据 "containing" 元素对行进行排序?我有一个 table 的跨行单元格,这些单元格只应该在它们包含的跨列中排序。
var $sortable = $('.nested-sortable tbody');
$sortable.sortable({
helper: function (e, ui) {
ui.children().each(function () {
$(this).width($(this).width());
});
return ui;
}
});
列 Make 不是 sortable。 Type 列在其 "container" 中只能是 sortable,即 Make 列。这意味着类型 1 和 2 不能被丢弃到品牌 2,类型 3 不能被丢弃到品牌 1。子类型和模型也是如此。
jQuery UI 或 table 是否可以开箱即用?谢谢。
显然,我只需要添加另一个 tbody 选择器即可使其工作:
$(function(){
var $sortable = $('.nested-sortable tbody tbody');
$sortable.sortable({
axis:'y',
helper: function (e, ui) {
ui.children().each(function () {
$(this).width($(this).width());
});
return ui;
}
});
});
有没有办法让 jQuery UI 的 sortable() 仅根据 "containing" 元素对行进行排序?我有一个 table 的跨行单元格,这些单元格只应该在它们包含的跨列中排序。
var $sortable = $('.nested-sortable tbody');
$sortable.sortable({
helper: function (e, ui) {
ui.children().each(function () {
$(this).width($(this).width());
});
return ui;
}
});
列 Make 不是 sortable。 Type 列在其 "container" 中只能是 sortable,即 Make 列。这意味着类型 1 和 2 不能被丢弃到品牌 2,类型 3 不能被丢弃到品牌 1。子类型和模型也是如此。
jQuery UI 或 table 是否可以开箱即用?谢谢。
显然,我只需要添加另一个 tbody 选择器即可使其工作:
$(function(){
var $sortable = $('.nested-sortable tbody tbody');
$sortable.sortable({
axis:'y',
helper: function (e, ui) {
ui.children().each(function () {
$(this).width($(this).width());
});
return ui;
}
});
});