【问题标题】:Row reordering not works in Datatable jquery plugin行重新排序在 Datatable jquery 插件中不起作用
【发布时间】:2017-11-06 23:38:52
【问题描述】:

我使用的是 Datatable 插件版本 - 1.10.15

我想让我的表行可拖动以更改排序顺序,为此我使用数据表的“行重新排序”功能,但它不起作用

给我一​​个错误:Uncaught TypeError: table.rowReordering is not a function

This is my work 但不起作用

我正在尝试包含所有相关的外部资源

我的脚本是

$(document).ready(function() {
  var table = $('#example').DataTable({
    "iDisplayLength": 50,
    'createdRow': function(row, data, dataIndex) {
      $(row).attr('id', 'row-' + dataIndex);
    }
  });

  table.rowReordering();
});

请通过查看我的示例帮助我找出我哪里出错了

【问题讨论】:

  • 嘿 Nidhi,我想你可能也在寻找类似的东西?click here
  • $(document).ready(function() { var table = $('#example').DataTable({ iDisplayLength: 50, rowReorder: true, createdRow: function(row, data, dataIndex) { $(row).attr('id', 'row-' + dataIndex); } }); });
  • 谢谢你的帮助,是的@JaykumarGondaliya 我从这里得到提示并按照步骤操作但给了我一个错误。你可以看到我的尝试。我在我的问题中提供小提琴链接
  • 谢谢@AlivetoDie。我试过你的答案。它可以拖动行但不会卡在某个位置。见here
  • 嘿@Nidhi 请检查here

标签: jquery datatable


【解决方案1】:

我使用DataTables 1.10.9, RowReorder 1.0.0解决了我的问题

这里正在处理数据表子行

简单的解决方案是:

var table = $('#example').DataTable({
  rowReorder: true,
  "iDisplayLength": 50,
});

DEMO

【讨论】:

  • 太棒了!刚果@NIdhi
  • 这是你的辛勤工作......我什么都做不了。 :-) 它对我们很有帮助。谢谢@Nidhi
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2014-08-26
  • 1970-01-01
  • 2016-08-31
  • 2013-12-01
  • 2017-08-11
  • 1970-01-01
  • 2014-11-14
相关资源
最近更新 更多