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 6199929
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T04:16:37+00:00 2026-05-24T04:16:37+00:00

I am using jquery.dataTables (1.8.1) to display a list of data, and I am

  • 0

I am using jquery.dataTables (1.8.1) to display a list of data, and I am displaying it into a 3×3 grid. I don’t want to use the header since it is not necessary.

Here’s my javascript:

$('table.grid_view').dataTable({
    "oLanguage": {
        "sSearch": "<p style='margin:5px 0;'>Search:</p>"
    },
    "bLengthChange": false,
    "bFilter": true,
    "bSort": false,
    "bAutoWidth": false,
    "iDisplayLength": 3,
    "sPaginationType": "full_numbers",
    "aoColumns": [null,null,null]
});

and here’s the table:

<div id='grid_wrap'>
    <table class="grid_view">
        <tbody>
        <?php
        if (!empty($grid_datas)){
            $i = 1;
            $index = 0;
            foreach ($grid_datas as $grid_data){
                $index++;
                if($i == 0){ echo '<tr>';}
                if($index == count($grid_datas)){$colspan = $index % 3;}
                else{$colspan = 1;}
            ?>
                <td>
                    <?php echo $grid_data['the_data'];?>
                </td>
            <?php
                if($index == count($grid_datas) || $index % 3 == 0){
                    echo '</tr>';
                    $i = 0;
                }else{$i++;}
            }?>
        </tbody>
        <?php }else{?>
        <tr>
            <td>No data Found</td>
        </tr>
        <?php }?>
    </table>
</div>

actually this pretty much work, but the datatable is alerting message

DataTables warning: Requested unknown parameter ‘2’ from the data
source for row 3

and when I check it in firebug, here’s what happens:

DataTables warning: Unexpected number of TD elements. Expected 12 and
got 11. DataTables does not support rowspan / colspan in the table
body, and there must be one cell for each row/column combination.

from the sound of it, it seems that I only have 11 $grid_data to display while dataTables is expecting 12 since the table is resulting 4 rows, and since i didn’t initiate any header(thead), it seems that the dataTable is generating this on the fly:

<thead>
    <tr>
        <th class="sorting_disabled" rowspan="1" colspan="1"></th>
        <th class="sorting_disabled" rowspan="1" colspan="1"></th>
        <th class="sorting_disabled" rowspan="1" colspan="1"></th>
    </tr>
</thead>

I have spent some time modifying the table or the javascript so that it wont give any alert, I have also search for any possible solutions, but none of them seems to work, please help me

  • 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-24T04:16:39+00:00Added an answer on May 24, 2026 at 4:16 am

    Keep your all tr in side tbody

    <div id='grid_wrap'>
        <table class="grid_view">
            <tbody>
            <?php
            if (!empty($grid_datas)){
                $i = 1;
                $index = 0;
                foreach ($grid_datas as $grid_data){
                    $index++;
                    if($i == 0){ echo '<tr>';}
                    if($index == count($grid_datas)){$colspan = $index % 3;}
                    else{$colspan = 1;}
                ?>
                    <td>
                        <?php echo $grid_data['the_data'];?>
                    </td>
                <?php
                    if($index == count($grid_datas) || $index % 3 == 0){
                        echo '</tr>';
                        $i = 0;
                    }else{$i++;}
                }?>
    
            <?php }else{?>
            <tr>
                <td>No data Found</td>
            </tr>
            <?php }?>
          </tbody>
        </table>
    </div>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm using jquery datatables to display data inside grid. On init page load script
I am using jQuery datatables to display some data. Each row has an edit
I am using DataTables (jQuery plugin) to display my tabular data. If fetches data
I'm using the jQuery DataTables plugin to display data being returned from an AJAX
I am using the JQuery DataTables plugin for displaying large sets of data. One
I am using jquery datatables to display data from a mysql database. When you
i want to show my input data from DB...i'm interest for using jquery dataTable...
I am using jQuery DataTables . I want to remove the search bar and
Hello i am using Jquery data table to display a table from the server
I am using the jQuery plugin called DataTables and I would like to display

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.