<?xml version="1.0" encoding="UTF-8"?><!-- generator="wordpress/2.3.2" -->
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	>
<channel>
	<title>Comments on: Table Drag and Drop JQuery plugin</title>
	<link>http://www.isocra.com/2008/02/table-drag-and-drop-jquery-plugin/</link>
	<description>Just another WordPress weblog</description>
	<pubDate>Mon, 12 May 2008 10:37:54 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.3.2</generator>
		<item>
		<title>By: uweiss</title>
		<link>http://www.isocra.com/2008/02/table-drag-and-drop-jquery-plugin/#comment-230</link>
		<dc:creator>uweiss</dc:creator>
		<pubDate>Wed, 07 May 2008 11:51:45 +0000</pubDate>
		<guid>http://www.isocra.com/2008/02/table-drag-and-drop-jquery-plugin/#comment-230</guid>
		<description>in reply to DenisH's post April 28th, 2008 at 9:30 pm 

If a row is being dragged at the moment on another table, the currentTable variable will be overwritten and we get problems. In that case, here's an external javascript function for serialization, which of course may be changed for other serialization formats

&lt;pre&gt;
function serializeTableOrdering(table) {
  if (table) {
    var result = "";
    var tableId = table.id;
    var rows = table.rows;
    for (var i=0; i 0) result += "&#38;";
        result += tableId + '[]=' + rows[i].id;
    }
    return result;
  }
  return "";
}
&lt;/pre&gt;

cheers</description>
		<content:encoded><![CDATA[<p>in reply to DenisH&#8217;s post April 28th, 2008 at 9:30 pm </p>
<p>If a row is being dragged at the moment on another table, the currentTable variable will be overwritten and we get problems. In that case, here&#8217;s an external javascript function for serialization, which of course may be changed for other serialization formats</p>
<pre>
function serializeTableOrdering(table) {
  if (table) {
    var result = "";
    var tableId = table.id;
    var rows = table.rows;
    for (var i=0; i 0) result += "&amp;";
        result += tableId + '[]=' + rows[i].id;
    }
    return result;
  }
  return "";
}
</pre>
<p>cheers</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jeroen</title>
		<link>http://www.isocra.com/2008/02/table-drag-and-drop-jquery-plugin/#comment-229</link>
		<dc:creator>Jeroen</dc:creator>
		<pubDate>Wed, 07 May 2008 07:31:48 +0000</pubDate>
		<guid>http://www.isocra.com/2008/02/table-drag-and-drop-jquery-plugin/#comment-229</guid>
		<description>Hi there,

This is truely awesome work! I'm quite new ot this, but is it possible to handle this as a questionnaire and have the results 'sorting' send to a db for evaluation?

Thanks in advance!</description>
		<content:encoded><![CDATA[<p>Hi there,</p>
<p>This is truely awesome work! I&#8217;m quite new ot this, but is it possible to handle this as a questionnaire and have the results &#8217;sorting&#8217; send to a db for evaluation?</p>
<p>Thanks in advance!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Andrew</title>
		<link>http://www.isocra.com/2008/02/table-drag-and-drop-jquery-plugin/#comment-220</link>
		<dc:creator>Andrew</dc:creator>
		<pubDate>Mon, 05 May 2008 08:05:35 +0000</pubDate>
		<guid>http://www.isocra.com/2008/02/table-drag-and-drop-jquery-plugin/#comment-220</guid>
		<description>I have added a enable/disable function to this drag and drop, i would like if you could impliment one for future releases, i will post mine but it might not be the best way of doing it. I have also taken out the .css("cursor", "move") aswell and added in my own css class to make it easier to remove on disable and to make the code look prettier. (I don't like inline css)

Here is the link to the code, the highlighted bits are the changes.

http://pastebin.com/f4e702774</description>
		<content:encoded><![CDATA[<p>I have added a enable/disable function to this drag and drop, i would like if you could impliment one for future releases, i will post mine but it might not be the best way of doing it. I have also taken out the .css(&#8221;cursor&#8221;, &#8220;move&#8221;) aswell and added in my own css class to make it easier to remove on disable and to make the code look prettier. (I don&#8217;t like inline css)</p>
<p>Here is the link to the code, the highlighted bits are the changes.</p>
<p><a href="http://pastebin.com/f4e702774" rel="nofollow">http://pastebin.com/f4e702774</a></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: James Nylen</title>
		<link>http://www.isocra.com/2008/02/table-drag-and-drop-jquery-plugin/#comment-206</link>
		<dc:creator>James Nylen</dc:creator>
		<pubDate>Sat, 03 May 2008 20:30:03 +0000</pubDate>
		<guid>http://www.isocra.com/2008/02/table-drag-and-drop-jquery-plugin/#comment-206</guid>
		<description>Oh - I also removed the .style("cursor", "move") wherever that was.  I think when I used {dragHandle: ".drag"} the whole row still had the move cursor, and I'd rather do that in my stylesheet anyway.</description>
		<content:encoded><![CDATA[<p>Oh - I also removed the .style(&#8221;cursor&#8221;, &#8220;move&#8221;) wherever that was.  I think when I used {dragHandle: &#8220;.drag&#8221;} the whole row still had the move cursor, and I&#8217;d rather do that in my stylesheet anyway.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: James Nylen</title>
		<link>http://www.isocra.com/2008/02/table-drag-and-drop-jquery-plugin/#comment-205</link>
		<dc:creator>James Nylen</dc:creator>
		<pubDate>Sat, 03 May 2008 20:25:19 +0000</pubDate>
		<guid>http://www.isocra.com/2008/02/table-drag-and-drop-jquery-plugin/#comment-205</guid>
		<description>Nice work.  I wanted to define a specific class as a dragHandle, so I made the following changes:
&lt;pre&gt;
    build: function(options) {
        // Make sure options exists
        options = options &#124;&#124; {};
        // Set up the defaults if any

        this.each(function() {
            // Remember the options
            this.tableDnDConfig = {
                dragHandle: options.dragHandle ? options.dragHandle : "td", ///// added this
                onDragStyle: options.onDragStyle,
                onDropStyle: options.onDropStyle,

...

    makeDraggable: function(table) {
        // Now initialise the rows
        var rows = table.rows; //getElementsByTagName("tr")
        var config = table.tableDnDConfig;
        for (var i=0; i&#60;rows.length; i++) {
            // To make non-draggable rows, add the nodrag class (eg for Category and Header rows) 
			// inspired by John Tarr and Famic
            var nodrag = $(rows[i]).hasClass("nodrag");
            if (! nodrag) { //There is no NoDnD attribute on rows I want to drag
                jQuery(rows[i]).mousedown(function(ev) {
                    if (jQuery(ev.target).is(config.dragHandle)) { ///// changed this
                        jQuery.tableDnD.dragObject = this;
                        jQuery.tableDnD.currentTable = table;

...
&lt;/pre&gt;
That way the existing functionality will be the same, unless you specify a dragHandle selector.</description>
		<content:encoded><![CDATA[<p>Nice work.  I wanted to define a specific class as a dragHandle, so I made the following changes:</p>
<pre>
    build: function(options) {
        // Make sure options exists
        options = options || {};
        // Set up the defaults if any

        this.each(function() {
            // Remember the options
            this.tableDnDConfig = {
                dragHandle: options.dragHandle ? options.dragHandle : "td", ///// added this
                onDragStyle: options.onDragStyle,
                onDropStyle: options.onDropStyle,

...

    makeDraggable: function(table) {
        // Now initialise the rows
        var rows = table.rows; //getElementsByTagName("tr")
        var config = table.tableDnDConfig;
        for (var i=0; i&lt;rows.length; i++) {
            // To make non-draggable rows, add the nodrag class (eg for Category and Header rows)
			// inspired by John Tarr and Famic
            var nodrag = $(rows[i]).hasClass("nodrag");
            if (! nodrag) { //There is no NoDnD attribute on rows I want to drag
                jQuery(rows[i]).mousedown(function(ev) {
                    if (jQuery(ev.target).is(config.dragHandle)) { ///// changed this
                        jQuery.tableDnD.dragObject = this;
                        jQuery.tableDnD.currentTable = table;

...
</pre>
<p>That way the existing functionality will be the same, unless you specify a dragHandle selector.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: sb</title>
		<link>http://www.isocra.com/2008/02/table-drag-and-drop-jquery-plugin/#comment-191</link>
		<dc:creator>sb</dc:creator>
		<pubDate>Fri, 02 May 2008 11:16:22 +0000</pubDate>
		<guid>http://www.isocra.com/2008/02/table-drag-and-drop-jquery-plugin/#comment-191</guid>
		<description>This is great. Simple, light-weight, easy to implement. Thank you!</description>
		<content:encoded><![CDATA[<p>This is great. Simple, light-weight, easy to implement. Thank you!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: DenisH</title>
		<link>http://www.isocra.com/2008/02/table-drag-and-drop-jquery-plugin/#comment-175</link>
		<dc:creator>DenisH</dc:creator>
		<pubDate>Mon, 28 Apr 2008 21:30:06 +0000</pubDate>
		<guid>http://www.isocra.com/2008/02/table-drag-and-drop-jquery-plugin/#comment-175</guid>
		<description>Hi Andy and Sara, 

I must admit I hadn't anticipated people wanting to call serialize from outside the onDrop, but I think you can achieve the same thing with the following lines:
&lt;pre&gt;
	jQuery.tableDnD.currentTable = document.getElementById("table-3"); // use your table ID obviously
	alert(jQuery.tableDnD.serialize());
&lt;/pre&gt;
&lt;button onclick='jQuery.tableDnD.currentTable = document.getElementById("table-3");alert(jQuery.tableDnD.serialize());'&gt;Try it now&lt;/button&gt;

Basically all you need to do is ensure that currentTable is initialized to the right document element and then serialize() works as required.

In the next version I'll wrap this up more neatly.</description>
		<content:encoded><![CDATA[<p>Hi Andy and Sara, </p>
<p>I must admit I hadn&#8217;t anticipated people wanting to call serialize from outside the onDrop, but I think you can achieve the same thing with the following lines:</p>
<pre>
	jQuery.tableDnD.currentTable = document.getElementById("table-3"); // use your table ID obviously
	alert(jQuery.tableDnD.serialize());
</pre>
<p><button onclick='jQuery.tableDnD.currentTable = document.getElementById("table-3");alert(jQuery.tableDnD.serialize());'>Try it now</button></p>
<p>Basically all you need to do is ensure that currentTable is initialized to the right document element and then serialize() works as required.</p>
<p>In the next version I&#8217;ll wrap this up more neatly.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: andy</title>
		<link>http://www.isocra.com/2008/02/table-drag-and-drop-jquery-plugin/#comment-174</link>
		<dc:creator>andy</dc:creator>
		<pubDate>Mon, 28 Apr 2008 19:07:37 +0000</pubDate>
		<guid>http://www.isocra.com/2008/02/table-drag-and-drop-jquery-plugin/#comment-174</guid>
		<description>This is really great plugin. I have been able to get some php behind it and update list order for a form generator. Now I just need to figure out how to do the following:

after I add a new element to table-1 I am able to delete and sort rows. I want to be able to call serialize without starting the drag and drop. ie. add form field (6) delete form field (2). submit form -fire serialize function.

I just can't figure out how to access the serialize function even if the tr elements did not change position (were not dragged) 

any suggestions??

great work on this plugin</description>
		<content:encoded><![CDATA[<p>This is really great plugin. I have been able to get some php behind it and update list order for a form generator. Now I just need to figure out how to do the following:</p>
<p>after I add a new element to table-1 I am able to delete and sort rows. I want to be able to call serialize without starting the drag and drop. ie. add form field (6) delete form field (2). submit form -fire serialize function.</p>
<p>I just can&#8217;t figure out how to access the serialize function even if the tr elements did not change position (were not dragged) </p>
<p>any suggestions??</p>
<p>great work on this plugin</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: smilypie</title>
		<link>http://www.isocra.com/2008/02/table-drag-and-drop-jquery-plugin/#comment-144</link>
		<dc:creator>smilypie</dc:creator>
		<pubDate>Wed, 23 Apr 2008 04:18:50 +0000</pubDate>
		<guid>http://www.isocra.com/2008/02/table-drag-and-drop-jquery-plugin/#comment-144</guid>
		<description>Denis nice work on this plugin!

@Sara - you could populate just one hidden field with the jquery serialised list after every drop and then access that field after posting the form. Alternatively (and i find this easier to work with), if you only need to know the new arrangement of id's you could try adding the unique id to each row via a hidden form field, for example:

 First Row Content  
 Second Row Content  

Where each value is the database id. After you submit the form, the rearranged id's in their new order should be available as an array $_POST['row_id']; Hope that made sense...</description>
		<content:encoded><![CDATA[<p>Denis nice work on this plugin!</p>
<p>@Sara - you could populate just one hidden field with the jquery serialised list after every drop and then access that field after posting the form. Alternatively (and i find this easier to work with), if you only need to know the new arrangement of id&#8217;s you could try adding the unique id to each row via a hidden form field, for example:</p>
<p> First Row Content<br />
 Second Row Content  </p>
<p>Where each value is the database id. After you submit the form, the rearranged id&#8217;s in their new order should be available as an array $_POST[&#8217;row_id&#8217;]; Hope that made sense&#8230;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Sara</title>
		<link>http://www.isocra.com/2008/02/table-drag-and-drop-jquery-plugin/#comment-138</link>
		<dc:creator>Sara</dc:creator>
		<pubDate>Wed, 16 Apr 2008 20:44:36 +0000</pubDate>
		<guid>http://www.isocra.com/2008/02/table-drag-and-drop-jquery-plugin/#comment-138</guid>
		<description>Perfect! Just what I am looking for. Could you possibly provide a sample bit of code where you click a 'submit' button after sorting to submit a serialized list of the sorted table to a php script? I see how you do it with ajax on each drop, but that would be more calls than I need to the database. (Sorry if what I am asking for is obvious - I am a jQuery n00b!)</description>
		<content:encoded><![CDATA[<p>Perfect! Just what I am looking for. Could you possibly provide a sample bit of code where you click a &#8217;submit&#8217; button after sorting to submit a serialized list of the sorted table to a php script? I see how you do it with ajax on each drop, but that would be more calls than I need to the database. (Sorry if what I am asking for is obvious - I am a jQuery n00b!)</p>
]]></content:encoded>
	</item>
</channel>
</rss>
