Drag and drop rows in a jqgrid

拈花ヽ惹草 提交于 2019-12-04 11:41:33

I was having the same problem so I looked into your example.

Made a few changes and now it seems to work.

Include: jQuery UI.js as this is where the base jquery drag and drop code is. Include: jquery.tablednd.js

Move the Dnd call and sortable rows calls to after you create the grid.

Working fiddle: http://jsfiddle.net/netroworx/6wMm7/

$(document).ready(function() {
    jQuery("#mytable").jqGrid({
      datatype:"clientSide",
      data:[ {"number": 1, "segment":"first", "name": "chap0"},
             {"number": 2, "segment":"second",  "name": "chap1"},
             {"number": 3, "segment":"third",  "name": "chap2"},
           ],
      colNames:['Chapter Name', 'Chapter Number', 'Document Segment'],
      colModel:[
              {name:'name'},
              {name:'number', sorttype:'number'},
              {name:'segment'},
              ],
      autowidth:true,
      height:'200',
      sortname: 'number',
      viewrecords: true,
      caption: 'My first grid',
      altRows:true

  }); 
   jQuery("#mytable").sortableRows();   
   jQuery("#mytable").jqGrid('gridDnD');

        });
标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!