zoukankan      html  css  js  c++  java
  • js设置datagriad的行移动

       //                    ,
    //                formatter: function(value,row,index){
    //                    var download = row.priority+
    //                        "&nbsp;&nbsp;&nbsp;<a href="#" id = "V_up_"+index+"" class="easyui-linkbutton" data-options="iconCls:'icon-add'" onclick=moveUp(this,"
    //                                + index+ ","+row.priority+","+row.id+")>上移</a>"
    //                                 +"<a href="#" id = "V_down_"+index+"" class="easyui-linkbutton" data-options="iconCls:'icon-add'" onclick=movedown(this,"
    //                                + index+ ")>下移</a>";
    //                    return download;
    //                    }
    function moveUp(value, index, priority,id) { var $tr = $(value).parents("tr"); if ($tr.index() != 0) { $tr.fadeOut().fadeIn(); $tr.prev().before($tr); } var columns = $('#dataGrid').datagrid("options").columns; // 得到rows对象 var rows = $('#dataGrid').datagrid("getRows"); // 这段代码是// 对某个单元格赋值 var changeRows = ""; var beichangeRows =""; if(index == 0){ beichangeRows = 2; changeRows = 1; }else{ changeRows = rows[index-1].priority; beichangeRows = priority; } //进入后台更新优先级 updatePriority(rows[index].id+"@"+changeRows,rows[index-1].id+"@"+beichangeRows); } function movedown(value, index,row) { var len = value.length; var $tr = $(value).parents("tr"); if ($tr.index() != len - 1) { $tr.fadeOut().fadeIn(); $tr.next().after($tr); } var columns = $('#dataGrid').datagrid("options").columns; // 得到rows对象 var rows = $('#dataGrid').datagrid("getRows"); // 这段代码是// 对某个单元格赋值 var changeRows = ""; var beichangeRows =""; if(index == len - 1){ beichangeRows =rows[index].priority; changeRows = rows[index+1].priority;; updatePriority(rows[index].id+"@"+changeRows,rows[index+1].id+"@"+beichangeRows); } }



        /**
         * 更新优先级
         * @param changeRows
         * @param beichangeRows
         */
        
        function updatePriority(changeRows,beichangeRows){
             $.ajax({
                    url: '../productConfig/updatePriority',
                    data: {"changeRows":changeRows,"beichangeRows":beichangeRows},
                    type: 'post',
                    dataType: 'json',
                    success: function(r) {
                         $('#dataGrid').datagrid("reolad")
                    }
                });
        }
  • 相关阅读:
    linux下mysql忘记密码
    ORACLE 锁表处理,解锁释放session
    二.hadoop环境搭建
    并行与并发的理解
    PgSQl临时表的创建
    UNION types numeric and text cannot be matched
    Excel 自定义关闭按钮
    Excel关闭事件
    VBA 获得绝对地址控制焦点的设置
    Excel TargetRange.Validation为空的
  • 原文地址:https://www.cnblogs.com/tian830937/p/4807424.html
Copyright © 2011-2022 走看看