zoukankan      html  css  js  c++  java
  • 利用插件(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=" 100%;"> <th class="th1" style=" 15%;"><label for="aggVDtselectAll"><input type="checkbox" v-model='aggVCheckAllDt' @click='checkedAggVAllDt()' name="" id="aggVDtselectAll" value="" />全选</label></th> <th class="th2" style=" 30%;">输出</th> <th class="th3" style=" 40%">需求</th> <th class="th4" style=" 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; },
  • 相关阅读:
    Protobuf
    CPU profiling
    转 Unicode 和 UTF-8 的区别
    Redis数据结构底层知识总结
    MySQL 加锁处理分析 ---非常牛逼
    MySQL Gap Lock问题
    利用Linux文件系统内存cache来提高性能
    Xcode7安装CocoaPods
    字符串排列组合算法
    iOS项目开发实战——学会使用TableView列表控件(四)plist读取与Section显示
  • 原文地址:https://www.cnblogs.com/xuxiaoxia/p/8484455.html
Copyright © 2011-2022 走看看