当前位置: 代码迷 >> 综合 >> (开发笔记)前端jqGrid/dataGrid表格拖动/拖拽行
  详细解决方案

(开发笔记)前端jqGrid/dataGrid表格拖动/拖拽行

热度:68   发布时间:2024-01-24 10:13:55.0

 扩展:

var ids=$('#dataGrid').jqGrid('getGridParam','selarrrow');//获取被选中行的id
<table id="dataGrid"></table>
<script src="${ctxStatic}/jqGrid/4.7/plugins/jquery.tablednd.js?${_version}"></script>
    $(document).ready(function () {$( "#dataGrid" ).tableDnD();});
// 初始化DataGrid对象
$('#dataGrid').dataGrid({searchForm: $("#searchForm"),showRownum: true,	    // 是否显示行号gridComplete : function () {$( "#dataGrid" ).tableDnDUpdate(); //更新jquery.tablednd.js插件的方法。},columnModel: [{header:'${text("字段名称")}', name:'filedch', index:'a.filedch', width:150, align:"left", frozen:true, formatter: function(val, obj, row, act){return '<a href="${ctx}/sorder/sorder/form?id='+row.id+'" class="btnList" data-title="${text("编辑排序定义")}">'+(val||row.id)+'</a>';}},{header:'${text("排序方式")}', name:'orderway', index:'a.orderway', width:150, align:"left"},{header:'${text("排序号")}', name:'orderindex', index:'a.orderindex', width:150, align:"center"},{header:'${text("操作")}', name:'actions', width:120, sortable:false, title:false, formatter: function(val, obj, row, act){var actions = [];<% if(hasPermi('sorder:sorder:edit')){ %>actions.push('<a href="${ctx}/sorder/sorder/form?id='+row.id+'" class="btnList" title="${text("编辑排序定义")}"><i class="fa fa-pencil"></i></a>&nbsp;');actions.push('<a href="${ctx}/sorder/sorder/delete?id='+row.id+'" class="btnList" title="${text("删除排序定义")}" data-confirm="${text("确认要删除该排序定义吗?")}"><i class="fa fa-trash-o"></i></a>&nbsp;');<% } %>return actions.join('');}}],// 加载成功后执行事件ajaxSuccess: function(data){}
});