在jqgrid中拖放行 [英] Drag and drop rows in a jqgrid

查看:136
本文介绍了在jqgrid中拖放行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试拖动& jqgrid中行的drop选项.我已经尝试过 fiddle .非常感谢您提出的宝贵建议.

I am trying a drag & drop option for rows in a jqgrid. I have tried with this fiddle. Thanks a lot for any valuable suggestions.

我尝试过

jQuery("#mytable").gridDnD();

以及

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

推荐答案

我遇到了同样的问题,所以我调查了您的示例.

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

进行了一些更改,现在看来可以正常工作.

Made a few changes and now it seems to work.

包括:jQuery UI.js,因为这是基本jquery拖放代码所在的位置. 包括:jquery.tablednd.js

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

在创建网格后将Dnd调用和可排序行调用移动到.

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

正在工作的小提琴: 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');

        });

这篇关于在jqgrid中拖放行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆