aspose file tools*
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 EJB 3 in Action this week in the EJB and other Java EE Technologies 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
Author

Draggable() is not working in jquery

Sulaiman Malik
Greenhorn

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;
//alert(tab_title);
$tabs.tabs('add', '#tabs-'+tab_counter, tab_title);

var newTableDiv = $("<div />",{id: 'dialog'+tab_counter});
newTableDiv.appendTo("body");
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">'+
'<tr><th><strong>Symbol</strong></th>'+
'<th><strong>Price</strong></th>'+
'<th><strong>Volume</strong></th>'+
'<th><strong>Buy</strong></th>'+
'<th><strong>Sell</strong></th></tr></thead>'+
'<tbody id="sortable'+tab_counter+'" class="ui-widget-content">'+
'<tr><td>PSO</td><td>100.00</td><td>12</td><td>120.00</td><td>130.00</td></tr>'+
'<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);
$(newTableDiv).append(newTable);
$('#myTable'+tab_counter).draggable(); //This is draggable
$('#myTable'+tab_counter).tablesorter();
$( '#sortable'+tab_counter).sortable();
}
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60041
    
  65

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
Greenhorn

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: http://aspose.com/file-tools
 
subject: Draggable() is not working in jquery
 
Similar Threads
Export dynamic table gen in jsp to excel
request.getParameter retuning null
Resizing HTML Table Columns
table columns not sorted by Tablekit after AJAX call and <div> is added
Problem on getting values from a radio buttons group