Problem using individual column filtering API

Problem using individual column filtering API

NewinthezoneNewinthezone Posts: 22Questions: 0Answers: 0
edited April 2012 in General
Hi
I am having a problem using the code for filtering data column wise. The regular code i.e $('#table1').dataTable() works for me.
But when I try using the code mentioned in the Datatables Individual column filtering example on this website , it doesnt work.
I am simply copy pasting the code from there and changing the id to that of my table i.e 'table1'
Please help me , Im new to programming.

This is my code
[code]









var asInitVals = new Array();

$(document).ready(function () {
var oTable = $('#table1').dataTable({
"oLanguage": {
"sSearch": "Search all columns:"
}
});

$("tfoot input").keyup(function () {
/* Filter on the column (the index) of this element */
oTable.fnFilter(this.value, $("tfoot input").index(this));
});



/*
* Support functions to provide a little bit of 'user friendlyness' to the textboxes in
* the footer
*/
$("tfoot input").each(function (i) {
asInitVals[i] = this.value;
});

$("tfoot input").focus(function () {
if (this.className == "search_init") {
this.className = "";
this.value = "";
}
});

$("tfoot input").blur(function (i) {
if (this.value == "") {
this.className = "search_init";
this.value = asInitVals[$("tfoot input").index(this)];
}
});
});







IDNameDesignation



1
Tom
Security

2
Chang
Supervisor

3
Wong
Security




IDNameDesignation






[/code]
This discussion has been closed.