sData is Undefined - using a table inside another table

sData is Undefined - using a table inside another table

eddie909eddie909 Posts: 31Questions: 6Answers: 0
edited February 2011 in General
I just searched the forum for this error and received many great responses. I double checked my code and I do not see anything wrong with my table structure. I am using a table inside another table.
Here is a copy of my code:
[code]<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">




DataTables example

@import "demo_page.css";
@import "demo_table.css";





$(document).ready(function() {
$('input[name="filter"]', this).click( function () {
var checkboxs = document.getElementsByName('filter');
var reg_exp = '';

for (var i = 0, inp; inp = checkboxs[i]; i++) {

if (inp.type.toLowerCase() == 'checkbox' && inp.checked) {
reg_exp = reg_exp + inp.value + '|';
}
}
var oTable = $('#example').dataTable();
/* Add a select menu for each TH element in the table footer */
$("tfoot th").each( function ( i ) {
if (reg_exp == '') {
reg_exp = 'X|'
} else {
oTable.fnFilter( reg_exp.slice(0, -1), 1, true, false, false );
}
} ); //tfoot th
} ); // filter click

$('input[name="classTime"]', this).click( function () {

var checkboxs = document.getElementsByName('classTime');
var reg_exp = '';

for (var i = 0, inp; inp = checkboxs[i]; i++) {

if (inp.type.toLowerCase() == 'checkbox' && inp.checked) {
reg_exp = reg_exp + inp.value + '|';

}

}
var oTable = $('#example').dataTable();

/* Add a select menu for each TH element in the table footer */

$("tfoot th").each( function ( i ) {
if (reg_exp == '') {
reg_exp = 'X|'
} else {
oTable.fnFilter( reg_exp.slice(0, -1), 1, true, false, false );
}

} ); //tfoot th
} ); // classTime click
} ); // ready function




Live example




Index



Meeting Day
Meeting Times
Location







111



Mon
12:45pm - 2:30pm
4


Wed
12:45pm - 2:30pm
4
























Monday


Tuesday

Wed

Thur


Fri

Sat



Monday Afternoon






[/code]

Thanks,

- Ed

Replies

  • eddie909eddie909 Posts: 31Questions: 6Answers: 0
    Allan,

    Thank you so much for getting back to me, I added the code as you suggested and also changed my checkbox but what table id (the outer table id or the inner table id's) do I use for the following:

    When I use the outer table id - i get sData is undefined - if I use inner table id I get oColumn is undefined.

    [code]
    $(document).ready(function() {
    /* Initialise datatables */
    var oTable = $('#data1').dataTable();
    $('#monday_afternoon').click( function() { oTable.fnDraw(); } );

    } ); [/code]
    Thanks,
    - Ed
This discussion has been closed.