Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 5956137
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T18:12:50+00:00 2026-05-22T18:12:50+00:00

I am posting this question for a second time. and i still didn’t get

  • 0

I am posting this question for a second time. and i still didn’t get any answer. Its been like four days and i have been stuck into this problem. draggable() is not working in dynamically created tables i have compared the DOM of manually created table and dynamic table every thing is same, but it works in manually created table and not in dynamic table. It means in manually i can move the table columns like reordering and not in dynamic. Please i need help in this. below 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" width="100%" border="0"  cellspacing="1" cellpadding="2">'+
                    '<thead id="myTableHead'+tab_counter+'" class="ui-widget-header" style="display: table-header-group;">'+
                    '<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" style="display: table-row-group;">'+ 
'<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);
        $(newTableDiv).append(newTable);

        $('#myTable'+tab_counter).tablesorter(); 
        $('#myTable'+tab_counter).draggable(); //**not working**

        $( '#sortable'+tab_counter).sortable();         

        if ( $("#myTable"+tab_counter).length > 0 ) {
            alert("id exists");
        }
        alert("#myTable"+tab_counter);


        var myDiv = $("<div />", { "class":"ui-tabs-panel ui-widget-content ui-corner-bottom",id: 'tabs-'+tab_counter});
        myDiv.append("#tabs");

        $("#sortable"+tab_counter).show();
        $("#myTableHead"+tab_counter).show();

        $('#dialog'+tab_counter).prependTo('#tabs-'+tab_counter);           
        tab_counter++;
        //alert(tab_counter);
    }

I need help in this.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-22T18:12:51+00:00Added an answer on May 22, 2026 at 6:12 pm

    Your using .draggable which is a jQuery UI method but it won’t work to drag around the columns simply by attaching it to the table header. You’ll need to ultilise a helper function:

    For dragtable, although the documentation says to:

    Add class=”draggable” to any table you might like to reorder.

    This is a bit simplistic to say because the developer should realise things can be created dynamically in Javascript!

    In other words, just simply adding the class draggable to the dynamically created table will NOT work. This is because draggable has already add event listeners after executing the init for all the tables when the DOM is ready. Changing the class will not automatically add an event listener. If this was a jQuery plugin, it could of used .live to attach event listeners to any dynamically created table now and in the future, but unfortunately it’s not.

    You’ll need to attach a dragtable onto the newly created table, try:

    dragtable.makeDraggable(newTable);
    

    Edit:

    Make sure your acting on the table element itself, not a jQuery object i.e.:

    dragtable.makeDraggable(newTable[0]);
    

    Fiddle: http://jsfiddle.net/garreh/64pyb/

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

After posting this question and reading that one I realized that it is very
I'm posting this in the spirit of answering your own questions. The question I
(I've tried posting this on YUI message group but without any luck) Can anyone
This is similar to my previous posting. But this time I want to call
This may sound like a SuperUser issue, but I wrote the page in question
I'm a newbie on Ant so instead of posting this on the official buglist(because
How would you define testing? In the interest of full disclosure, I'm posting this
I started getting this error when posting the form back with Model Binder. To
I've actually solved this, but I'm posting it for posterity. I ran into a
This is in continuation of my previous questions (sorry for re-posting similar type of

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.