jqgrid中具有拖放行的树结构?
我正在为表中的树结构使用jqgrid。我正在提供拖放行功能。我想在拖动事件上调用回调方法。因为我想调整行的层次结构,这是一个包含数字的列,例如:1.1,1.2.1,…我可以这样做吗。 以下是我在html中编写的代码:jqgrid中具有拖放行的树结构?,jqgrid,Jqgrid,我正在为表中的树结构使用jqgrid。我正在提供拖放行功能。我想在拖动事件上调用回调方法。因为我想调整行的层次结构,这是一个包含数字的列,例如:1.1,1.2.1,…我可以这样做吗。 以下是我在html中编写的代码: jQuery(function(){ jQuery("#tree").tableDnD({scrollAmount:0}); jQuery("#tree").jqGrid({ url:'jsonSamplePots.json', datatype: "json", colName
jQuery(function(){
jQuery("#tree").tableDnD({scrollAmount:0});
jQuery("#tree").jqGrid({
url:'jsonSamplePots.json',
datatype: "json",
colNames: ["Task Id", "Task No.", "Task Name", "Priority", "Start Date", "End Date", "Task Type", "Link", "Link RelationShip", "Resources(Units)", "Reference"],
colModel: [
{name:'id', index:'id', width: 30, hidden: true, key: true},
{name:'no', width:80, sortable:false,editable:true},
{name:'name', width:150, sortable:false,editable:true},
{name:'priority', width:80, sortable:false,editable:true},
{name:'sDate', width:80, sortable:false},
{name:'eDate', width:80, sortable:false},
{name:'type', width:120, sortable:false},
{name:'link', width:80, sortable:false},
{name:'rship', width:80, sortable:false},
{name:'resources', width:300, sortable:false},
{name:'ref', width:80, sortable:false},
],
rowNum:10,
rowList:[10,20,30],
pager: '#pcelltbl',
sortname: 'id',
viewrecords: true,
sortorder: "desc",
caption:"Tasks",
cellEdit:true,
treeGrid: true,
ExpandColumn:'name',
gridComplete: function() {
//alert("gridcomplete");
$("#_empty","#tree").addClass("nodrag nodrop");
jQuery("#tree").tableDnDUpdate();
},
我正在使用以下json数据:
{
"total": "1",
"page": "1",
"records": "2",
"rows": [
{"id": "1", "cell": ["1", "Super <b>Item</b>", "300", "0", "", "false", "true", "true"]},
{"id": "2", "cell": ["2", "<a href='http://www.google.com'>Google</a>", "100", "1", "1", "false", "false", "true"]},
{"id": "3", "cell": ["3", "Sub Item 1", "50", "2", "2", "true", "true", "true"]},
{"id": "4", "cell": ["4", "Sub Item 2", "25", "2", "2", "false", "false", "true"]},
{"id": "5", "cell": ["5", "Sub-sub Item 1", "25", "3", "4", "true", "true", "true"]},
{"id": "6", "cell": ["6", "Sub Item 3", "25", "2", "2", "true", "true", "true"]},
{"id": "7", "cell": ["7", "<span style='background-color:LightGreen; color:Tomato'>Item 2</span>", "200", "1", "1", "false", "true", "true"]},
{"id": "8", "cell": ["8", "Sub Item 1", "100", "2", "7", "false", "false", "true"]},
{"id": "9", "cell": ["9", "Sub-sub Item 1", "50", "3", "8", "true", "true", "true"]},
{"id": "10", "cell": ["10", "Sub-sub Item 2", "50", "3", "8", "true", "true", "true"]},
{"id": "11", "cell": ["11", "Sub Item 2", "100", "2", "7", "true", "true", "true"]}
]
}
提前感谢感谢您查看此帖子:成功了。。。tableDnD{onDrop:functiontable,第{//行,在这里写逻辑};我阅读了你的帖子,并尝试使用TreeGrid扩展sortableRows。我没有足够的时间让它工作到最后,但是移动节点仍然没有它的所有子节点。看到初步的演示。谢谢你看这篇文章:成功了。。。tableDnD{onDrop:functiontable,第{//行,在这里写逻辑};我阅读了你的帖子,并尝试使用TreeGrid扩展sortableRows。我没有足够的时间让它工作到最后,但是移动节点仍然没有它的所有子节点。请参阅初步演示。