我有一个“舞动” jqgrid,可从其中拖动(实际复制)项目到2或3个辅助网格(“ ProgPrepGrids”)之一中。这很好。 如果我将所有内容设置为也能够从一个辅助网格拖动到任何其他也可以使用的辅助网格中,也可以拖动行以在目标辅助网格中对它们进行重新排序,但是我无法拖动行以在辅助网格中对它们进行重新排序,而无法从中拖动到其他网格。
我真正想要的是能够随意在任何辅助网格之间拖放-是否有可能在拖动单个网格内的行的同时不失去重新排序的功能?
在下面的代码中,我仅将一个ProgPrepGrid连接到其他DnD。注释掉的部分将它们连接在一起-但以失去对每个网格本身重新排序的能力为代价。
function CreatePrepGrids(sessions){
// Create Programme prep grids (jqGrids)
var nsess=sessions.length, gridshtml='', i, ns1 = nsess-1, sid, begin, end, caption;
for(i=0 ; i<nsess ; i++) {
sid = sessions[i].ID;
gridshtml += '<div><table class=\'ProgPrepGrid\' id=ProgPrepGrid_'+sid+'></table></div>';
}
$('#ProgPrepGrids').empty(); // clear out any previous event data
$('#ProgPrepGrids').html(gridshtml);
for(i=0 ; i<nsess ; i++) {
sid = sessions[i].ID;
begin = moment(sessions[i].Start).format('h:mma');
end = moment(sessions[i].Finish).format('h:mma');
caption = sessions[i].Name;
if(sessions[i].Spares===0) { caption += ', '+begin+' - '+end; }
$('#ProgPrepGrid_'+sid).jqGrid({
datatype: 'local',
colModel: ((i==ns1) ? PrepDanceCols(true) : PrepDanceCols(false)),
idPrefix: '_ppg'+sid,
data: ProgPrepData[sid],
altRows: true,
altclass: 'myAltRowClass',
caption: caption,
width: '650px',
cellEdit: true,
cellsubmit: 'clientArray',
cmTemplate: { editable: false, autoResizable: true },
actionsNavOptions: { editbutton: false },
afterInsertRow: function() {
SetChangeFlag(true);
},
onSelectRow: function() {
SetChangeFlag(true);
}
})
.jqGrid('sortableRows');
}
// appearance/behaviour
//$('.ui-jqgrid-hdiv').hide();
$('.ui-jqgrid-titlebar').click(function() { // Expand/collapse just by clicking on the caption bar
$('.ui-jqgrid-titlebar-close', this).click();
});
// Now connect the grids for drag & drop between them
var grid, gridlist = '';
for(i=0 ; i<ns1 ; i++) {
// for(i=0 ; i<=ns1 ; i++) {
if(i>0) { gridlist += ','; }
grid = '#ProgPrepGrid_'+sessions[i].ID;
gridlist += grid;
}
// Connect last grid (spares) to previous ones
sid = sessions[ns1].ID; // the id of the spares grid
$('#ProgPrepGrid_'+sid).jqGrid('gridDnD',{
connectWith: gridlist,
ondrop: function(e, ui) { SaveCallingProgramme(false); },
droppos: 'afterSelected'
});
// Connect dances grid to all the prep grids
gridlist += ',#ProgPrepGrid_'+sid;
$('#DanceGridTable').jqGrid('gridDnD',{
connectWith: gridlist,
ondrop: function(e, ui) { SaveCallingProgramme(false); },
droppos: 'afterSelected',
dragcopy: true
});
/*
// Connect dances grid to all the prep grids
$('#DanceGridTable').jqGrid('gridDnD',{
connectWith: gridlist,
ondrop: function(e, ui) { SaveCallingProgramme(false); },
droppos: 'afterSelected',
dragcopy: true
});
// Connect all the prep grids to each other, without connecting to itself
for(j=0 ; j<=ns1 ; j++) {
gridlist = '';
sid = sessions[j].ID;
for(i=0; i<=ns1; i++) {
if(j!=i) {
if(gridlist.length>0) { gridlist += ','; }
grid = '#ProgPrepGrid_'+sessions[i].ID;
gridlist += grid;
}
}
$('#ProgPrepGrid_'+sid).jqGrid('gridDnD',{
connectWith: gridlist,
ondrop: function(e, ui) { SaveCallingProgramme(false); },
droppos: 'afterSelected',
dragcopy: false
});
}
*/
}