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")
                    }
                });
        }
  • 相关阅读:
    【安卓本卓】Android系统源码篇之(一)源码获取、源码目录结构及源码阅读工具简介
    【朝花夕拾】Android性能篇之(六)Android进程管理机制
    【烂笔头】adb命令篇
    【朝花夕拾】Android性能篇之(五)Android虚拟机
    【朝花夕拾】Android性能篇之(一)序言及JVM
    【烂笔头】git常用命令篇
    【朝花夕拾】Android性能篇之(四)Apk打包
    【朝花夕拾】Android Log篇
    从2015年百度站长的一则公告回头看百度的骚操作
    ASP.NET Core+Quartz.Net 实现web定时任务
  • 原文地址:https://www.cnblogs.com/tian830937/p/4807424.html
Copyright © 2011-2022 走看看