<?xml version="1.0" encoding="UTF-8"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
<channel>
	<title>jQuery Grid Plugin - jqGrid - Topic: Help:  Using Row DnD and grouping to associate objects between jqGrid tables.</title>
	<link>http://www.trirand.com/blog/?page_id=393/help/help-using-row-dnd-and-grouping-to-associate-objects-between-jqgrid-tables</link>
	<description><![CDATA[Grid plugin]]></description>
	<generator>Simple:Press Version 5.7.5.3</generator>
	<atom:link href="http://www.trirand.com/blog/?page_id=393/help/help-using-row-dnd-and-grouping-to-associate-objects-between-jqgrid-tables/rss" rel="self" type="application/rss+xml" />
        <item>
        	<title>shane74 on Help:  Using Row DnD and grouping to associate objects between jqGrid tables.</title>
        	<link>http://www.trirand.com/blog/?page_id=393/help/help-using-row-dnd-and-grouping-to-associate-objects-between-jqgrid-tables#p23734</link>
        	<category>Help</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/help/help-using-row-dnd-and-grouping-to-associate-objects-between-jqgrid-tables#p23734</guid>
        	        	<description><![CDATA[<p>Hello,</p>
<p>First, let me say thanks for the continuing work!&#160; This is a great product and I am enjoying experimenting with the new changes in 4.1.</p>
<p>A little background on my problem-</p>
<p>I have been developing an application that allows the user to allocated orders (1..n) between different delivery Trips.&#160; I have an Orders object that contains all the usual stuff plus a trip_id to reference a Trip object.&#160; The Trip object contains the driver name, trip time, etc.&#160; My webpage for allocating orders to drivers looks something like:</p>
<p>----------------------</p>
<p>jqGrid 1 (Trips table - actually filled with allocated Orders where order.trip_id != None)</p>
<p>&#160;- Grouping by order.trip_id splits Orders into groups so that the user can see individual Trips and associated Orders)</p>
<p>&#160;- Uses DnDRows to drag rows from Trip to Unallocated Orders to remove orders from a trip.</p>
<p>----------------------</p>
<p>----------------------</p>
<p>jqGrid 2 (Unallocated Orders - filled with orders where order.trip_id==None)</p>
<p>&#160; - HERE IS THE PROBLEM:&#160; Trying to use DnD rows to drag Orders onto row of Trip table in order to allocate orders to a Trip.&#160; 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?</p>
<p>----------------------</p>
<p>I have gotten Grouping and Row DnD to all work as shown in the examples.&#160; I can move orders out of Trip table and back into Order to deallocate them from a Trip.&#160; I can move orders from Order to Trip and allocate them to the last/first listed Trip, but not to others.&#160; To allocate to the correct Trip, I need to get data about the target row onto which I am dropping (the ui.droppable).&#160; The ondrop event gives me a ui.target.id that is the trip table name, not the name of the target row.&#160; This implies that the &#39;gridDnD&#39; binds ui.droppable to the entire Trip table rather than individual rows within.</p>
<p>So, finally, the question.&#160; 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.&#160; 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).&#160; Below you will see my JS setup code for what I am trying to do:</p>
<p>&#160;&#160;&#160; &#160;&#160;&#160;&#160; jQuery("#order_table").jqGrid(&#39;gridDnD&#39;,{ <br />&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160;&#160; connectWith:&#39;#trip_table&#39;,<br />&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160;&#160; dropbyname: true,<br />&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160;&#160; ondrop: function (ev, ui, getdata) {<br />&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160;&#160; // From OrderTable to Triptable, dropped order_id and target trip_id are both passed.<br />&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160;&#160; var dragged_order_id = $(ui.draggable).attr("id");<br />&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160;&#160; // var order_data = $(&#39;#order_table&#39;).jqGrid(&#39;getRowData&#39;, dragged_order_id)<br />&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; // How do I do this?????</p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; var target_order_trip_id = ???????? // NOT found using ui.target!!!<br />&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160;&#160; window.location = "/dispatch/dropRow?order_id="+dragged_order_id+&#39;;trip_id=&#39;+trip_id<br />&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160;&#160; },&#160;&#160; &#160;&#160;&#160; &#160;<br />&#160;&#160;&#160; &#160;&#160;&#160;&#160; });</p>
<p>Development Info:</p>
<p>jqGrid 4.1, jquery-1.5.2.min, jquery-ui-1.8.13.custom.minin a Pylon environment.</p>
<p>Thanks,</p>
<p>Shane</p>
]]></description>
        	        	<pubDate>Thu, 23 Jun 2011 07:45:12 +0300</pubDate>
        </item>
</channel>
</rss>