<?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: JQGrid Draggable event drops after sorting or Pagination</title>
	<link>http://www.trirand.com/blog/?page_id=393/help/jqgrid-draggable-event-drops-after-sorting-or-pagination</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/jqgrid-draggable-event-drops-after-sorting-or-pagination/rss" rel="self" type="application/rss+xml" />
        <item>
        	<title>thanushka on JQGrid Draggable event drops after sorting or Pagination</title>
        	<link>http://www.trirand.com/blog/?page_id=393/help/jqgrid-draggable-event-drops-after-sorting-or-pagination#p30353</link>
        	<category>Help</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/help/jqgrid-draggable-event-drops-after-sorting-or-pagination#p30353</guid>
        	        	<description><![CDATA[<p>I an new to JQGrid, and I have implemented the the grid to drag a row and drop to another control. The issue is if I click a column name for sorting or change the no of rows to display, the draggable event will get dropped. Any idea on how to rebind them since some events are fired before the sorting happens. Following is the grid implimentation.</p>
<pre class="default prettyprint prettyprinted"><p><input type='button' class='sfcodeselect' name='sfselectit3087' value='Select Code' data-codeid='sfcode3087' /></p><div class='sfcode' id='sfcode3087'> $(&#34;#grid&#34;).jqGrid({
        url: &#39;@Url.Action(&#34;OnOrderItemLoad&#34;,&#34;ResourcePlan&#34;)&#39;,
        datatype: &#34;json&#34;,
        colNames: [&#39;Select&#39;, &#39;OrderItemId&#39;, &#39;Overseas Office&#39;, &#39;Gender Category&#39;,&#160;</div><p><input type='button' class='sfcodeselect' name='sfselectit6646' value='Select Code' data-codeid='sfcode6646' /></p><div class='sfcode' id='sfcode6646'>&#39;Product Name&#39;, &#39;Design&#39;, &#39;Product Type&#39;, &#39;Country Of Origin&#39;, &#39;Factory Name&#39;, &#39;FCA Date&#39;,&#160;</div><p><input type='button' class='sfcodeselect' name='sfselectit3649' value='Select Code' data-codeid='sfcode3649' /></p><div class='sfcode' id='sfcode3649'>&#39;Inspection Date&#39;, &#39;Order No&#39;, &#39;Line Item Qty&#39;, &#39;Gcc Approval&#39;, &#39;Green Seal&#39;, &#39;Black Seal&#39;,</div><p><input type='button' class='sfcodeselect' name='sfselectit5963' value='Select Code' data-codeid='sfcode5963' /></p><div class='sfcode' id='sfcode5963'> &#39;Ship Mode&#39;],
        colModel: [
            { name: &#39;Select&#39;, index: &#39;MyCol&#39;, editable:true, edittype:&#39;checkbox&#39;,&#160;</div><p><input type='button' class='sfcodeselect' name='sfselectit2391' value='Select Code' data-codeid='sfcode2391' /></p><div class='sfcode' id='sfcode2391'>editoptions: { value:&#34;True:False&#34;}, formatter: &#34;checkbox&#34;,&#160;</div><p><input type='button' class='sfcodeselect' name='sfselectit2569' value='Select Code' data-codeid='sfcode2569' /></p><div class='sfcode' id='sfcode2569'>formatoptions: {disabled : false}},
             { name: &#39;OrderItemId&#39;, index: &#39;OrderItemId&#39; ,hidden:true},
            { name: &#39;OverseasOffice&#39;, index: &#39;OverseasOffice&#39;},
            { name: &#39;GenderCategory&#39;, index: &#39;GenderCategory&#39; },
            { name: &#39;ProductName&#39;, index: &#39;ProductName&#39; },
            { name: &#39;Design&#39;, index: &#39;Design&#39; },
            { name: &#39;ProductType&#39;, index: &#39;ProductType&#39; },
            { name: &#39;CountryOfOrigin&#39;, index: &#39;CountryOfOrigin&#39; },
            { name: &#39;FactoryName&#39;, index: &#39;FactoryName&#39; },
            { name: &#39;FCADate&#39;, index: &#39;FCADate&#39; },
            { name: &#39;InspectionDate&#39;, index: &#39;InspectionDate&#39; },
            { name: &#39;OrderNo&#39;, index: &#39;OrderNo&#39; },
            { name: &#39;LineItemQty&#39;, index: &#39;LineItemQty&#39; },
            { name: &#39;GccApproval&#39;, index: &#39;GccApproval&#39; },
            { name: &#39;GreenSeal&#39;, index: &#39;GreenSeal&#39; },
            { name: &#39;BlackSeal&#39;, index: &#39;BlackSeal&#39; },
            { name: &#39;ShipMode&#39;, index: &#39;ShipMode&#39; }
        ],
        // height: 250,
        rowNum: 10,
        rowList: [10, 20, 30],
        pager: &#39;#pager2&#39;,
        viewrecords: true,
        sortorder: &#34;desc&#34;,
        loadonce:true,
        onSortCol: makeGridRowsDraggable(grid)

    });
</div></pre>
<div>
<pre class="default prettyprint prettyprinted"><p><input type='button' class='sfcodeselect' name='sfselectit619' value='Select Code' data-codeid='sfcode619' /></p><div class='sfcode' id='sfcode619'>  jQuery(&#34;#grid&#34;).jqGrid(&#39;navGrid&#39;, &#39;#pager2&#39;, { edit: false, add: false, del: false });

    $(&#34;#grid&#34;).jqGrid({ gridComplete: makeGridRowsDraggable($(&#34;#&#34; + this.id)) });</div></pre>
</div>
<div>Following is the implimentation of Draggable event</div>
<div>
<pre class="default prettyprint prettyprinted"><p><input type='button' class='sfcodeselect' name='sfselectit2637' value='Select Code' data-codeid='sfcode2637' /></p><div class='sfcode' id='sfcode2637'>function makeGridRowsDraggable(grid) {
        setTimeout(function () {
            createDroppableElements();
            $(&#34;#grid&#34;).val(new Date().getTime());
            var $searchResultsGrid = grid;
            var searchResultsRows = $(&#34;#grid .ui-row-ltr&#34;);

            searchResultsRows.draggable({ appendTo: &#34;body&#34; });

            searchResultsRows.draggable({
                create: function (event, ui) { }
            });

            searchResultsRows.css(&#34;cursor&#34;, &#34;move&#34;).draggable(&#34;option&#34;, &#34;helper&#34;, &#34;clone&#34;)</div><p><input type='button' class='sfcodeselect' name='sfselectit7438' value='Select Code' data-codeid='sfcode7438' /></p><div class='sfcode' id='sfcode7438'>.draggable({
                revert: &#34;true&#34;,
                appendTo: &#39;body&#39;,
                cursor: &#34;move&#34;,
                snap: &#34;true&#34;,
                cursorAt: {
                top:80,
                left: -5
                },
                helper: function (event) {
                    //get a hold of the row id
                    var rowId = $(this).attr(&#39;id&#39;);

                    var rowData = jQuery(&#34;#grid&#34;).getRowData(rowId);
                    Id = &#34;&#60;table&#62;&#60;tr&#62;&#60;td class=&#39;seprt&#39;&#62;Overseas Office : &#34;&#160;</div><p><input type='button' class='sfcodeselect' name='sfselectit5288' value='Select Code' data-codeid='sfcode5288' /></p><div class='sfcode' id='sfcode5288'>+ rowData[&#39;OverseasOffice&#39;] + &#34;&#60;/td&#62;&#60;td class=&#39;seprt&#39;&#62;Product Name: &#34;&#160;</div><p><input type='button' class='sfcodeselect' name='sfselectit5519' value='Select Code' data-codeid='sfcode5519' /></p><div class='sfcode' id='sfcode5519'>+ rowData[&#39;ProductName&#39;] + &#34;&#60;/td&#62;&#60;td class=&#39;seprt&#39;&#62;Factory Name: &#34; + rowData[&#39;FactoryName&#39;] + &#34;&#60;/td&#62;&#60;/tr&#62;&#60;/table&#62;&#34;;

                    //Create Event Object
                    var eventObject = {
                        id: rowData[&#39;OrderItemId&#39;]
                        , title: &#39;PO# &#39;+rowData[&#39;OrderNo&#39;]
                    };
                    var OrderItemId = rowData[&#39;OrderItemId&#39;];
                    $(this).data(&#39;eventObject&#39;, eventObject);
                    var dialog =  $(&#39;&#60;div class=&#34;draggedValue ui-widget-header&#160;</div><p><input type='button' class='sfcodeselect' name='sfselectit2179' value='Select Code' data-codeid='sfcode2179' /></p><div class='sfcode' id='sfcode2179'>ui-corner-all&#34;&#62;&#60;/div&#62;&#39;).appendTo(&#39;body&#39;);
                    dialog.html(Id);
                    return dialog;
                }
                , start: function (event, ui) {
                    //fade the grid
                    $(this).parent().fadeTo(&#39;fast&#39;, 0.5);
                }
                , stop: function (event, ui) {
                    $(this).parent().fadeTo(0, 1);
                }
            });
        }, 3000);
    }</div></pre>
</div>
]]></description>
        	        	<pubDate>Thu, 13 Mar 2014 15:31:14 +0200</pubDate>
        </item>
</channel>
</rss>