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")
                    }
                });
        }
  • 相关阅读:
    名字匹配(水题)
    奇怪的键盘
    杰杰的键盘
    Windows Message Queue(优先队列)
    筛法求素数
    会场安排问题(贪心)
    Sail
    Elevator
    Lowest Bit
    File Searching
  • 原文地址:https://www.cnblogs.com/tian830937/p/4807424.html
Copyright © 2011-2022 走看看