【文件属性】:
文件名称:bootstarp table行拖拽js.rar
文件大小:8KB
文件格式:RAR
更新时间:2022-07-02 05:41:27
js
实现bootStarp Table 表格行拖拽所需js,
table属性
onReorderRowsDrag: function(table, row) {
//取索引号
dragbeforeidx = $(row).attr("data-index");
},
//拖拽完成后的这条数据,并且可以获取这行数据的上一行数据和下一行数据
onReorderRowsDrop: function (table, row) {
//取索引号
draglateridx = $(row).attr("data-index");
},
//当拖拽结束后,整个表格的数据
onReorderRow: function (newData) {
//这里的newData是整个表格数据,数组形式
if (dragbeforeidx != draglateridx) {//这是我其他地方需要的,你们可不必要这个
console.log(newData);// 调试用代码
$.post("sortProject",
{ jsondata: JSON.stringify(newData) },//将整张表数据Post,当然,先序列化成Json
function(data) {
if (data == "success") {
$table.bootstrapTable('refresh');
}
});
}
}
});
【文件预览】:
bootstrap-table实现 行拖拽 插件jquery.tablednd.js bootstrap-table-reorder-rows.js bootstrap-table-reorder-rows.css
----bootstrap-table-reorder-rows.js(3KB)
----jquery.tablednd.js(23KB)
----bootstrap-table-reorder-rows.css(819B)