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

  • SEARCH
  • Home
  • 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 7539929
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T07:30:42+00:00 2026-05-30T07:30:42+00:00

I am trying to seperate a dynamically loaded 60 rows single column html table

  • 0

I am trying to seperate a dynamically loaded 60 rows single column html table to three column 20 rows using jquery in jsp.

example i Have a loaded table like this

test 1
test 2
test 3
test 4
test 5
test 6
test 7
test 8
test 9
test 10

i want to convert it like below with jquery

test 1    test 5    test 8
test 2    test 6    test 9
test 3    test 7    test 10
test 4    

code from

<div class="ui-jqdialog-content ui-widget-content" id="editcntgrid">
<span>
<form style="width: 100%; overflow: auto; position: relative; height: auto;" onsubmit="return false;" class="FormGrid" id="FrmGrid_grid" name="FormPost">
<table cellspacing="0" cellpadding="0" border="0" class="EditTable" id="TblGrid_grid">
<tbody>
<tr><td>test 1</td><td><input type="text" size="3" id="test1" name="test1" role="textbox" class="FormElement ui-widget-content ui-corner-all"></td></tr>
<tr><td>test 2</td><td><input type="text" size="3" id="test2" name="test2" role="textbox" class="FormElement ui-widget-content ui-corner-all"></td></tr>
<tr><td>test 3</td><td><input type="text" size="3" id="test3" name="test3" role="textbox" class="FormElement ui-widget-content ui-corner-all"></td></tr>
<tr><td>test 4</td><td><input type="text" size="3" id="test4" name="test4" role="textbox" class="FormElement ui-widget-content ui-corner-all"></td></tr>
<tr><td>test 5</td><td><input type="text" size="3" id="test5" name="test5" role="textbox" class="FormElement ui-widget-content ui-corner-all"></td></tr>
<tr><td>test 6</td><td><input type="text" size="3" id="test6" name="test6" role="textbox" class="FormElement ui-widget-content ui-corner-all"></td></tr>
<tr><td>test 7</td><td><input type="text" size="3" id="test7" name="test7" role="textbox" class="FormElement ui-widget-content ui-corner-all"></td></tr>
<tr><td>test 8</td><td><input type="text" size="3" id="test8" name="test8" role="textbox" class="FormElement ui-widget-content ui-corner-all"></td></tr>
<tr><td>test 9</td><td><input type="text" size="3" id="test9" name="test9" role="textbox" class="FormElement ui-widget-content ui-corner-all"></td></tr>
<tr><td>test 10</td><td><input type="text" size="3" id="test10" name="test10" role="textbox" class="FormElement ui-widget-content ui-corner-all"></td></tr>
</tbody>
</table>
</form>
</span>
</div>

code to be dynamically converted to below using jquery, making this into 3 columns,and need to have a flexibility to make to 4 columns if i have more rows.

<div class="ui-jqdialog-content ui-widget-content" id="editcntgrid">
<span>
<form style="width: 100%; overflow: auto; position: relative; height: auto;" onsubmit="return false;" class="FormGrid" id="FrmGrid_grid" name="FormPost">
<table cellspacing="0" cellpadding="0" border="0" class="EditTable" id="TblGrid_grid">
<tr>
<td>
<table>
<tbody>
<tr><td>test 1</td><td><input type="text" size="3" id="test1" name="test1" role="textbox" class="FormElement ui-widget-content ui-corner-all"></td></tr>
<tr><td>test 2</td><td><input type="text" size="3" id="test2" name="test2" role="textbox" class="FormElement ui-widget-content ui-corner-all"></td></tr>
<tr><td>test 3</td><td><input type="text" size="3" id="test3" name="test3" role="textbox" class="FormElement ui-widget-content ui-corner-all"></td></tr>
<tr><td>test 4</td><td><input type="text" size="3" id="test4" name="test4" role="textbox" class="FormElement ui-widget-content ui-corner-all"></td></tr>
</table>
</td>
<td>
<table>
<tr><td>test 5</td><td><input type="text" size="3" id="test5" name="test5" role="textbox" class="FormElement ui-widget-content ui-corner-all"></td></tr>
<tr><td>test 6</td><td><input type="text" size="3" id="test6" name="test6" role="textbox" class="FormElement ui-widget-content ui-corner-all"></td></tr>
<tr><td>test 7</td><td><input type="text" size="3" id="test7" name="test7" role="textbox" class="FormElement ui-widget-content ui-corner-all"></td></tr>
</table>
</td>
<td>
<table>
    <tr><td>test 8</td><td><input type="text" size="3" id="test8" name="test8" role="textbox" class="FormElement ui-widget-content ui-corner-all"></td></tr>
    <tr><td>test 9</td><td><input type="text" size="3" id="test9" name="test9" role="textbox" class="FormElement ui-widget-content ui-corner-all"></td></tr>
<tr><td>test 10</td><td><input type="text" size="3" id="test10" name="test10" role="textbox" class="FormElement ui-widget-content ui-corner-all"></td></tr>
</table>
</td>
</tr>
</tbody>
</table>
</form>
</span>
</div>

can someone help me on this?

Thanks.

  • 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-30T07:30:43+00:00Added an answer on May 30, 2026 at 7:30 am

    Are you not able to modify the how the table is initially built with Java? That would be the better way to handle this. If not, here’s my way to do it with jQuery:

    Dynamic # of columns: http://jsfiddle.net/nWdtq/5/

    2 column (as coded below): http://jsfiddle.net/UhKLm/3/ :

    var rows = $('#table_id tr').length;  // Number of rows in original table
    var half = Math.ceil(rows/2);         // Number of rows needed
    var remove = half+1;                  // Remove any rows after the halfway point
    
    // Loop through all the rows
    for(var x = 1; x <= rows; x++){
    
        // Find the child to go into the second column
        var second_ele = x + half;
    
        // If you half way and there is an odd number of entries
        if (x == half && rows % 2 != 0){
            continue;
        }
        // Find the row with the data for the second column (half + x)
        // and append the html to the current row's html
        else if (x <= half){
            $('#table_id tr:nth-child('+x+')').html(
                $('#table_id tr:nth-child('+x+')').html()+$('#table_id tr:nth-child('+second_ele+')').html()
            )
        }
        // Any entries after half way are already in the second column, remove them.
        else{
            $('#table_id tr:nth-child('+remove+')').remove();
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to have a table header, in a seperate div stay in
I have been trying to use a simple jQuery operation to dynamically match and
I´m trying to separate a gridViewColumn into two rows. Im using default style for
I am trying to play 6 seperate .mp3 sound files using instances of AVAudioPlayer.
I’m trying to do a full-text search in three seperate tables and sort the
I'm trying to use dynamically JTree component. Under root node I have four nodes
I am trying to use the NDbUnit. I have created seperate XSD for each
I have a flex .swf and a seperate AIR project which I'm trying to
I am trying to create a table dynamically in my code behind. My problem
I have been trying to implement 2 Seperate Contact Modals based off an original

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.