File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes HTML, CSS and JavaScript and the fly likes Draggable() is not working in jquery Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Barcodes with iOS this week in the iOS forum
or Core Java for the Impatient in the Java 8 forum!

JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "Draggable() is not working in jquery" Watch "Draggable() is not working in jquery" New topic

Draggable() is not working in jquery

Sulaiman Malik

Joined: Apr 12, 2010
Posts: 25
I have created a dynamic table in jquery and using draggable() to move the table columns (reordering). but it is not working. when i create a table manually then it is working fine, the columns are also moving, what am i doing wrong when i create a dynamic table then use draggable() by dynamic table id. I have been stuck in this problem from last couple of days. Here is my code.

function addTab() {
var tab_title = $tab_title_input.val() || 'Tab '+tab_counter;
$tabs.tabs('add', '#tabs-'+tab_counter, tab_title);

var newTableDiv = $("<div />",{id: 'dialog'+tab_counter});
alert("div appended to body"+" "+'dialog'+tab_counter);
var setCSS = {
'width' : '100%',
'cellSpacing' : '1px',
'cellpadding' : '2px'

var newTable = $('<table class="ui-widget">'+
'<thead id="myTableHead'+tab_counter+'" class="ui-widget-header">'+
'<tbody id="sortable'+tab_counter+'" class="ui-widget-content">'+
'<tr><td>ASO</td><td>200.00</td><td>11</td><td>120.00</td><td>130.00</td></tr></tbody></table>').attr('id', 'myTable'+tab_counter).css(setCSS);
$('#myTable'+tab_counter).draggable(); //This is draggable
$( '#sortable'+tab_counter).sortable();
Bear Bibeault
Author and ninkuma

Joined: Jan 10, 2002
Posts: 62101

Use Firebug or another debugger to compare the structure of the tables that work with those that don't. The difference is likely what is causing the issue.

[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Sulaiman Malik

Joined: Apr 12, 2010
Posts: 25
@Bear Bibeault ....I have checked the dom of manually created table and the dynamic one, each and everything is same but still not working .
I agree. Here's the link:
subject: Draggable() is not working in jquery