Forum


06:17

Hi,
In an early version of jqgrid, I used jquery ui draggable to allow me to drag a <tr> and drop on a <textarea> that is outside and in a different <div> than the jqgrid table. I used a custum helper as the drag helper, so that if the user dragged more than one row (selected by the multi select check boxes) the drag image showed custom text similar to moving multiple emails in hotmail, e.g. “moving 3 emails” instead of showing a clone of the <tr>.
Having upgraded to Ver 3.6, this no longer works. I can drag the <tr> and the custom helper works, but it is contained within the <tbody> of the jqgrid table, causing horizontal scrolling to occur when I drag to the left hand side, and the drag helper is not visible outside of the tbody.
Is there anyway to allow a <tr> to be dragged outside of the jqgrid table using jquery ui draggable? Same code below:
$(”#staffList”).jqGrid({
url:'ajax.php?p=staff&fn=getJsonBatch&nd='+new Date().getTime(),
datatype: “json”,
multiselect: true,
width: 400,
colNames:['staffid','name','surname'],
colModel:[ {name:'staffid',index:'staffid', width:55},
{name:'forename',index:'forename', width:90},
{name:'surname',index:'surname', width:100} ],
pager: '#pager2',
rowNum:<?=$rowsPerPage?>,
sortname: 'staffid',
scroll: false,
shrinkToFit: false,
scrollrows: false,
viewrecords: true,
sortorder: “desc”,gridComplete : function(){
$(”#staffList tbody tr”).draggable({
cursor: 'move',
cursorAt: {top: -12, left: -20},
containment: $('#mainbody'),
zIndex: 9999 ,
helper: function(event){
var vSelectedStaff = $(”#staffList”).getGridParam('selarrrow');
if(vSelectedStaff.length > 1){
return $('<div class=”ui-widget-header”>' + vSelectedStaff.length + ' staff members</div>');
}else {
return $('<div class=”ui-widget-header”>' + $(this).attr('id') + '</div>');
}
}
});
}});
00:25

Moderators
30/10/2007

Hello,
First I think that this is problem of draggable and not of jqGrid.
To work this IMHO you will need to specify the following options in the draggable: helper:"clone" and appendTo. You can look in grid.jqueryui.js of the method gridDnD in order to understand how is this organized.
Regards
Tony
For professional UI suites for Java Script and PHP visit us at our commercial products site - guriddo.net - by the very same guys that created jqGrid.
Most Users Ever Online: 715
Currently Online:
102 Guest(s)
Currently Browsing this Page:
1 Guest(s)
Top Posters:
OlegK: 1255
markw65: 179
kobruleht: 144
phicarre: 132
YamilBracho: 124
Renso: 118
Member Stats:
Guest Posters: 447
Members: 11373
Moderators: 2
Admins: 1
Forum Stats:
Groups: 1
Forums: 8
Topics: 10592
Posts: 31289
Newest Members:
, razia, Prankie, psky, praveen neelam, greg.valainis@pa-tech.comModerators: tony: 7721, Rumen[Trirand]: 81
Administrators: admin: 66