<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: Drag and Drop table content with JavaScript</title>
	<atom:link href="http://www.redips.net/javascript/drag-and-drop-table-content/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.redips.net/javascript/drag-and-drop-table-content/</link>
	<description>Techniques and Web Technologies</description>
	<lastBuildDate>Sat, 04 Feb 2012 16:29:46 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/</generator>
	<item>
		<title>By: dbunic</title>
		<link>http://www.redips.net/javascript/drag-and-drop-table-content/comment-page-34/#comment-5006</link>
		<dc:creator>dbunic</dc:creator>
		<pubDate>Wed, 01 Feb 2012 07:44:33 +0000</pubDate>
		<guid isPermaLink="false">http://www.redips.net/?p=63#comment-5006</guid>
		<description>1)
Yes, it&#039;s possible to create a new DIV element and place it manually to the table. New DIV element should contain &lt;strong&gt;drag&lt;/strong&gt; class name. After element is added to the table it should be &quot;enabled&quot; - please see documentation for &lt;a href=&quot;/javascript/redips-drag-documentation/#enable_drag&quot; title=&quot;REDIPS: documentation for enable drag method&quot; rel=&quot;nofollow&quot;&gt;enable_drag()&lt;/a&gt; method.

2)
REDIPS.drag library can have many separated drag containers like in &lt;a href=&quot;/my/preview/REDIPS_drag/example08/&quot; title=&quot;REDIPS: Tables in separated containers&quot; rel=&quot;nofollow&quot;&gt;example08 - Tables in separated containers&lt;/a&gt;. Elements from first container can&#039;t be dropped to the second container and vice versa. If you want to disable all elements in a table, that can be done with &lt;a href=&quot;/javascript/redips-drag-documentation/#enable_table&quot; title=&quot;REDIPS: enable_table() method&quot; rel=&quot;nofollow&quot;&gt;enable_table()&lt;/a&gt; method. So with using event handlers, enable/disable (toggle) table elements should not be a problem.</description>
		<content:encoded><![CDATA[<p>1)<br />
Yes, it's possible to create a new DIV element and place it manually to the table. New DIV element should contain <strong>drag</strong> class name. After element is added to the table it should be "enabled" - please see documentation for <a href="/javascript/redips-drag-documentation/#enable_drag" title="REDIPS: documentation for enable drag method" rel="nofollow">enable_drag()</a> method.</p>
<p>2)<br />
REDIPS.drag library can have many separated drag containers like in <a href="/my/preview/REDIPS_drag/example08/" title="REDIPS: Tables in separated containers" rel="nofollow">example08 - Tables in separated containers</a>. Elements from first container can't be dropped to the second container and vice versa. If you want to disable all elements in a table, that can be done with <a href="/javascript/redips-drag-documentation/#enable_table" title="REDIPS: enable_table() method" rel="nofollow">enable_table()</a> method. So with using event handlers, enable/disable (toggle) table elements should not be a problem.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: dman</title>
		<link>http://www.redips.net/javascript/drag-and-drop-table-content/comment-page-34/#comment-4999</link>
		<dc:creator>dman</dc:creator>
		<pubDate>Tue, 31 Jan 2012 07:16:54 +0000</pubDate>
		<guid isPermaLink="false">http://www.redips.net/?p=63#comment-4999</guid>
		<description>Thanks for the library.

Two quick questions:
1) is it possible to dynamically generate new table elements without user interaction?

2) is it possible to have two [div id=&quot;drag&quot;] sections on the page? When I do that only one is active.

Thanks</description>
		<content:encoded><![CDATA[<p>Thanks for the library.</p>
<p>Two quick questions:<br />
1) is it possible to dynamically generate new table elements without user interaction?</p>
<p>2) is it possible to have two [div id="drag"] sections on the page? When I do that only one is active.</p>
<p>Thanks</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: dbunic</title>
		<link>http://www.redips.net/javascript/drag-and-drop-table-content/comment-page-34/#comment-4987</link>
		<dc:creator>dbunic</dc:creator>
		<pubDate>Thu, 26 Jan 2012 07:46:47 +0000</pubDate>
		<guid isPermaLink="false">http://www.redips.net/?p=63#comment-4987</guid>
		<description>@Lakshman - &lt;strong&gt;drop_option&lt;/strong&gt; can be dynamically changed. Please see &lt;a href=&quot;/my/preview/REDIPS_drag/example09/&quot; title=&quot;REDIPS: Single and shift mode&quot; rel=&quot;nofollow&quot;&gt;Example 9: Single and shift mode&lt;/a&gt;. Here is code snippet from that example:
&lt;pre class=&quot;brush:js&quot;&gt;
// in a moment when DIV element is moved, set drop_option (shift or single)
rd.myhandler_moved = function () {
    // find parent table of moved element
    var tbl = rd.find_parent(&#039;TABLE&#039;, rd.obj);
    // if table id is table1
    if (tbl.id === &#039;table1&#039;) {
        rd.drop_option = &#039;shift&#039;;
    }
    else {
        rd.drop_option = &#039;single&#039;;
    }
};
&lt;/pre&gt;
On the similar way you can test DIV element id and set &quot;switch&quot; or &quot;multiple&quot; option:
&lt;pre class=&quot;brush:js&quot;&gt;
rd.myhandler_moved = function () {
    // set DIV element id
    var id = rd.obj.id;
    ...
&lt;/pre&gt;</description>
		<content:encoded><![CDATA[<p>@Lakshman - <strong>drop_option</strong> can be dynamically changed. Please see <a href="/my/preview/REDIPS_drag/example09/" title="REDIPS: Single and shift mode" rel="nofollow">Example 9: Single and shift mode</a>. Here is code snippet from that example:</p>
<pre class="brush:js">
// in a moment when DIV element is moved, set drop_option (shift or single)
rd.myhandler_moved = function () {
    // find parent table of moved element
    var tbl = rd.find_parent('TABLE', rd.obj);
    // if table id is table1
    if (tbl.id === 'table1') {
        rd.drop_option = 'shift';
    }
    else {
        rd.drop_option = 'single';
    }
};
</pre>
<p>On the similar way you can test DIV element id and set "switch" or "multiple" option:</p>
<pre class="brush:js">
rd.myhandler_moved = function () {
    // set DIV element id
    var id = rd.obj.id;
    ...
</pre>
]]></content:encoded>
	</item>
	<item>
		<title>By: Lakshman</title>
		<link>http://www.redips.net/javascript/drag-and-drop-table-content/comment-page-34/#comment-4975</link>
		<dc:creator>Lakshman</dc:creator>
		<pubDate>Tue, 24 Jan 2012 17:45:41 +0000</pubDate>
		<guid isPermaLink="false">http://www.redips.net/?p=63#comment-4975</guid>
		<description>@dbunic, first of all thank you for immediate response, the solution you have given will be very much useful.

I have one more question, I have two tables (say table1 &amp; table2) and in JavaScript I have set:
&lt;pre class=&quot;brush:js&quot;&gt;
rd.drop_option = &#039;switch&#039;; 
&lt;/pre&gt;

What I want is, if I click on any element in table1, certain cells in table2 (not all elements only certain DIV elements with some specific id)  should be disabled and should not allow to swap the content even though cell choosed from table1 is dropped on these elements.

Issue I am facing is: as drop option is set to switch, even though cell is set to disabled, after dropping  the element from table1 on disabled cell of table2 is swapping the elements.

Can you please suggest me, Is there any way to achieve this?</description>
		<content:encoded><![CDATA[<p>@dbunic, first of all thank you for immediate response, the solution you have given will be very much useful.</p>
<p>I have one more question, I have two tables (say table1 &amp; table2) and in JavaScript I have set:</p>
<pre class="brush:js">
rd.drop_option = 'switch';
</pre>
<p>What I want is, if I click on any element in table1, certain cells in table2 (not all elements only certain DIV elements with some specific id)  should be disabled and should not allow to swap the content even though cell choosed from table1 is dropped on these elements.</p>
<p>Issue I am facing is: as drop option is set to switch, even though cell is set to disabled, after dropping  the element from table1 on disabled cell of table2 is swapping the elements.</p>
<p>Can you please suggest me, Is there any way to achieve this?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: dbunic</title>
		<link>http://www.redips.net/javascript/drag-and-drop-table-content/comment-page-34/#comment-4967</link>
		<dc:creator>dbunic</dc:creator>
		<pubDate>Tue, 24 Jan 2012 07:31:42 +0000</pubDate>
		<guid isPermaLink="false">http://www.redips.net/?p=63#comment-4967</guid>
		<description>@Lakshman - REDIPS.drag doesn&#039;t have such method but here is JS code that might help you:
&lt;pre class=&quot;brush:js&quot;&gt;
// display Id of first DIV element inside table cell with coordinates
// tableIndex, rowIndex and cellIndex
function displayId(tableIndex, rowIndex, cellIndex) {
    // define local variables
    var tables, cell, div;
    // get tables inside REDIPS.drag container
    // (this can be globally set to skip possible overhead)
    tables = document.getElementById(&#039;drag&#039;).getElementsByTagName(&#039;table&#039;);
    // set reference to the table cell
    cell = tables[tableIndex].rows[rowIndex].cells[cellIndex];
    // mark cell to become visible (just for testing purpose)
    cell.style.backgroundColor = &#039;lime&#039;;
    // get references of DIV element(s) inside table cell
    div = cell.getElementsByTagName(&#039;div&#039;);
    // test if there is any DIV element
    if (div.length &gt; 0) {
        // display Id of first DIV element
        alert(div[0].id);
    }
}
&lt;/pre&gt;
... and how to use it:
&lt;pre class=&quot;brush:js&quot;&gt;
// display DIV Id for first table, third row and third column (cell)
displayId(0, 2, 2);
&lt;/pre&gt;</description>
		<content:encoded><![CDATA[<p>@Lakshman - REDIPS.drag doesn't have such method but here is JS code that might help you:</p>
<pre class="brush:js">
// display Id of first DIV element inside table cell with coordinates
// tableIndex, rowIndex and cellIndex
function displayId(tableIndex, rowIndex, cellIndex) {
    // define local variables
    var tables, cell, div;
    // get tables inside REDIPS.drag container
    // (this can be globally set to skip possible overhead)
    tables = document.getElementById('drag').getElementsByTagName('table');
    // set reference to the table cell
    cell = tables[tableIndex].rows[rowIndex].cells[cellIndex];
    // mark cell to become visible (just for testing purpose)
    cell.style.backgroundColor = 'lime';
    // get references of DIV element(s) inside table cell
    div = cell.getElementsByTagName('div');
    // test if there is any DIV element
    if (div.length > 0) {
        // display Id of first DIV element
        alert(div[0].id);
    }
}
</pre>
<p>... and how to use it:</p>
<pre class="brush:js">
// display DIV Id for first table, third row and third column (cell)
displayId(0, 2, 2);
</pre>
]]></content:encoded>
	</item>
	<item>
		<title>By: Lakshman</title>
		<link>http://www.redips.net/javascript/drag-and-drop-table-content/comment-page-34/#comment-4962</link>
		<dc:creator>Lakshman</dc:creator>
		<pubDate>Mon, 23 Jan 2012 16:35:53 +0000</pubDate>
		<guid isPermaLink="false">http://www.redips.net/?p=63#comment-4962</guid>
		<description>Hi,

In my case, i know row, col and table number and i want to get id of the cell (ie., i know position of my cell, but not the id of the element) Is there any method available to get id of div element ?

if not can you please let me know, how can we achieve this?</description>
		<content:encoded><![CDATA[<p>Hi,</p>
<p>In my case, i know row, col and table number and i want to get id of the cell (ie., i know position of my cell, but not the id of the element) Is there any method available to get id of div element ?</p>
<p>if not can you please let me know, how can we achieve this?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: WolveFred</title>
		<link>http://www.redips.net/javascript/drag-and-drop-table-content/comment-page-34/#comment-4954</link>
		<dc:creator>WolveFred</dc:creator>
		<pubDate>Sat, 21 Jan 2012 12:22:13 +0000</pubDate>
		<guid isPermaLink="false">http://www.redips.net/?p=63#comment-4954</guid>
		<description>@dbunic : Yes that works now ! Thank you !</description>
		<content:encoded><![CDATA[<p>@dbunic : Yes that works now ! Thank you !</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: dbunic</title>
		<link>http://www.redips.net/javascript/drag-and-drop-table-content/comment-page-34/#comment-4949</link>
		<dc:creator>dbunic</dc:creator>
		<pubDate>Fri, 20 Jan 2012 09:53:39 +0000</pubDate>
		<guid isPermaLink="false">http://www.redips.net/?p=63#comment-4949</guid>
		<description>@WolveFred - Sounds nice - hope it will work and thanks for helping others.

@Nivas - The easiest way is to create separated drag containers like in &lt;a href=&quot;/my/preview/REDIPS_drag/example08/&quot; title=&quot;REDIPS: Tables in separated containers&quot; rel=&quot;nofollow&quot;&gt;Example 8: Tables in separated containers&lt;/a&gt;. Just peek to the source. Here is code snippet of how to initialize each DIV container:
&lt;pre class=&quot;brush:js&quot;&gt;
// reference to the REDIPS.drag class
var rd = REDIPS.drag;
// DIV container initialization
rd.init(&#039;drag1&#039;);
rd.init(&#039;drag2&#039;);
&lt;/pre&gt;</description>
		<content:encoded><![CDATA[<p>@WolveFred - Sounds nice - hope it will work and thanks for helping others.</p>
<p>@Nivas - The easiest way is to create separated drag containers like in <a href="/my/preview/REDIPS_drag/example08/" title="REDIPS: Tables in separated containers" rel="nofollow">Example 8: Tables in separated containers</a>. Just peek to the source. Here is code snippet of how to initialize each DIV container:</p>
<pre class="brush:js">
// reference to the REDIPS.drag class
var rd = REDIPS.drag;
// DIV container initialization
rd.init('drag1');
rd.init('drag2');
</pre>
]]></content:encoded>
	</item>
	<item>
		<title>By: WolveFred</title>
		<link>http://www.redips.net/javascript/drag-and-drop-table-content/comment-page-34/#comment-4948</link>
		<dc:creator>WolveFred</dc:creator>
		<pubDate>Fri, 20 Jan 2012 08:26:49 +0000</pubDate>
		<guid isPermaLink="false">http://www.redips.net/?p=63#comment-4948</guid>
		<description>@Nivas : It is easy : set the id &quot;drag&quot; for the table that autorize drag and drop, and set nothing for the other table. It implies that the second table is not nested inside the first.</description>
		<content:encoded><![CDATA[<p>@Nivas : It is easy : set the id "drag" for the table that autorize drag and drop, and set nothing for the other table. It implies that the second table is not nested inside the first.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Nivas</title>
		<link>http://www.redips.net/javascript/drag-and-drop-table-content/comment-page-34/#comment-4945</link>
		<dc:creator>Nivas</dc:creator>
		<pubDate>Thu, 19 Jan 2012 11:18:17 +0000</pubDate>
		<guid isPermaLink="false">http://www.redips.net/?p=63#comment-4945</guid>
		<description>Hi,

My requirement is, The element should be drag and drop in the same Table, But When I try to drag it to another table, it should not. How can I achieve this?

Thanks,
Nivas</description>
		<content:encoded><![CDATA[<p>Hi,</p>
<p>My requirement is, The element should be drag and drop in the same Table, But When I try to drag it to another table, it should not. How can I achieve this?</p>
<p>Thanks,<br />
Nivas</p>
]]></content:encoded>
	</item>
</channel>
</rss>

