Forum

November 2nd, 2014
A A A
Avatar

Lost password?
Advanced Search

— Forum Scope —




— Match —





— Forum Options —





Minimum search word length is 3 characters - maximum search word length is 84 characters

The forums are currently locked and only available for read only access
sp_Feed Topic RSS sp_Related Related Topics sp_TopicIcon
Help: Using Row DnD and grouping to associate objects between jqGrid tables.
23/06/2011
07:45
Avatar
shane74
New Member
Members
Forum Posts: 1
Member Since:
23/06/2011
sp_UserOfflineSmall Offline

Hello,

First, let me say thanks for the continuing work!  This is a great product and I am enjoying experimenting with the new changes in 4.1.

A little background on my problem-

I have been developing an application that allows the user to allocated orders (1..n) between different delivery Trips.  I have an Orders object that contains all the usual stuff plus a trip_id to reference a Trip object.  The Trip object contains the driver name, trip time, etc.  My webpage for allocating orders to drivers looks something like:

----------------------

jqGrid 1 (Trips table - actually filled with allocated Orders where order.trip_id != None)

 - Grouping by order.trip_id splits Orders into groups so that the user can see individual Trips and associated Orders)

 - Uses DnDRows to drag rows from Trip to Unallocated Orders to remove orders from a trip.

----------------------

----------------------

jqGrid 2 (Unallocated Orders - filled with orders where order.trip_id==None)

  - HERE IS THE PROBLEM:  Trying to use DnD rows to drag Orders onto row of Trip table in order to allocate orders to a Trip.  Will redirect to server to set order.trip_id, but how to get the correct trip_id from the target row (Order) in Trip table?

----------------------

I have gotten Grouping and Row DnD to all work as shown in the examples.  I can move orders out of Trip table and back into Order to deallocate them from a Trip.  I can move orders from Order to Trip and allocate them to the last/first listed Trip, but not to others.  To allocate to the correct Trip, I need to get data about the target row onto which I am dropping (the ui.droppable).  The ondrop event gives me a ui.target.id that is the trip table name, not the name of the target row.  This implies that the 'gridDnD' binds ui.droppable to the entire Trip table rather than individual rows within.

So, finally, the question.  I need to know whether there is a way to make the individual rows within Trip bound to ui.droppable so that I can get data about the droppable target (the trip_id) onto which my draggable order row is placed.  I am just now starting to go through the source, but was hoping that someone could point me in the right direction (or even tell me if it is possible).  Below you will see my JS setup code for what I am trying to do:

         jQuery("#order_table").jqGrid('gridDnD',{
             connectWith:'#trip_table',
             dropbyname: true,
             ondrop: function (ev, ui, getdata) {
                 // From OrderTable to Triptable, dropped order_id and target trip_id are both passed.
                 var dragged_order_id = $(ui.draggable).attr("id");
                 // var order_data = $('#order_table').jqGrid('getRowData', dragged_order_id)
                // How do I do this?????

                 var target_order_trip_id = ???????? // NOT found using ui.target!!!
                 window.location = "/dispatch/dropRow?order_id="+dragged_order_id+';trip_id='+trip_id
             },        
         });

Development Info:

jqGrid 4.1, jquery-1.5.2.min, jquery-ui-1.8.13.custom.minin a Pylon environment.

Thanks,

Shane

Forum Timezone: Europe/Sofia

Most Users Ever Online: 715

Currently Online:
63 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.com

Moderators: tony: 7721, Rumen[Trirand]: 81

Administrators: admin: 66

Comments are closed.
Privacy Policy   Terms and Conditions   Contact Information