利用插件(jQuery-ui.js)实现表格行的拖拽排序

template 模板(html)

首先要引入jQuery-ui.js的文件、
import './../../scripts/base/jquery/jquery-ui.min.js';
<
table class="table-common" id="aggVDtTable"> <thead> <tr style="width: 100%;"> <th class="th1" style="width: 15%;"><label for="aggVDtselectAll"><input type="checkbox" v-model='aggVCheckAllDt' @click='checkedAggVAllDt()' name="" id="aggVDtselectAll" value="" />全选</label></th> <th class="th2" style="width: 30%;">输出</th> <th class="th3" style="width: 40%">需求</th> <th class="th4" style="width: 15%;">移动</th> </tr> </thead> <tbody> <tr v-for="(items, index) in aggregateValue" :key="aggregateValueDt.uniqueId + index"> <td ><input type="checkbox" name="" value="" v-model='items.isCheck' @change="aggVSingleSelectDt()"/></td> <td class="right" contenteditable="true">{{items.ruleName}}</td> <td class="right" data-toggle="modal" data-target=".modalShow" @click="aggDtItem = items" style="cursor: pointer">{{items.ruleSpecText}}</td> <!--<td style="display: none">{{items.ruleSpec}}</td>--> <td class="dragTd" style="cursor: move" @mousemove="dragTr($event,items)"><i class="fa fa-arrows"></i></td> </tr> </tbody> </table>

js代码:

//自定义维度指标表格可拖动行排序(jquery-ui)
//拖拽行的宽度设置 fixHelper(e,ui){ ui.children().each(function() { $(this).width($(this).width()); }); return ui; }, dragTr(event,item) { var that = this; $( "#aggVDtTable tbody").sortable({ cursor: "move", helper: that.fixHelper, axis:"y", revert: true, //释放时,增加动画 handle:".dragTd" , }); $( "#aggVDtTable").disableSelection(); return false; },

 

转载于:https://www.cnblogs.com/xuxiaoxia/p/8484455.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值