$(window).load(function ()
{
Load_Control();
//Character case Ignore method.
jQuery.expr[':'].ContainsIgnorecase = function (a, i, m) {
return jQuery(a).text().toUpperCase()
.indexOf(m[3].toUpperCase()) >= 0;
};
//Search - Keyup event.
$("input.vossers-filterfield")
.css("border", "1px solid #7f9db9")
.css("width", "100%")
.css("margin", "2px")
.css("padding", "2px")
.css("background", "pink")
.keyup(function () {
var inputClosure = this;
if (window.VossersFilterTimeoutHandle) {
clearTimeout(window.VossersFilterTimeoutHandle);
}
window.VossersFilterTimeoutHandle = setTimeout(function () {
var filterValues = new Array();
$("input.vossers-filterfield", $(inputClosure).parents("tr:first")).each(function () {
if ($(this).val() != "") {
filterValues[$(this).attr("filtercolindex")] = $(this).val();
}
});
//$("table.ms-listviewtable").children("tbody").find("tr").each(function ()
$("table.ms-listviewtable").children("tbody").each(function () {
$(this).children("tr").each(function () {
var mismatch = false;
$(this).children("td").each(function (colIndex) {
if (mismatch) return;
if (filterValues[colIndex]) {
var val = filterValues[colIndex];
// replace double quote character with 2 instances of itself
val = val.replace(/"/g, String.fromCharCode(34) + String.fromCharCode(34));
// verifies the filter word.ContainsIgnorecase
//if ($(this).is(":not(:contains('" + val + "'))")) {
if ($(this).is(":not(:ContainsIgnorecase('" + val + "'))")) {
mismatch = true;
}
}
});
if (mismatch) {
$(this).hide();
}
else {
$(this).show();
}
});
});
}, 250);
});
});
function Load_Control()
{
var tdset = "";
var tr = "";
// alert();
// $('table[id="{46B6AE08-85C5-43E1-A696-2D0624702208}-{E1F9407B-C482-4A09-A8D6-2F21C00AD247}"] tr.ms-viewheadertr').each(function()
//$('table[id="{520315BA-A75F-4A26-88E6-4594BA25D6E8}-{BC977D4A-87A4-4AFE-83FC-3D9ECD077A56}"] tr.ms-viewheadertr').each(function ()
alert($("table.ms-listviewtable tr.ms-viewheadertr"));
$("table.ms-listviewtable tr.ms-viewheadertr").each(function ()
{
if ($("td.ms-vh-group", this).size() > 0) {
return;
}
var colIndex = 0;
$(this).children("th,td").each(function () {
if ($(this).hasClass("ms-vh-icon")) {
// attachment
tdset += "<td></td>";
}
else
{
// filterable
if (colIndex == 2)
{
$("th").addClass("ms-vh2");
}
//tdset += "<td><input type='text' class='vossers-filterfield' filtercolindex='" + colIndex + "' /></td>";
}
colIndex++;
});
var tr = "<tr class='vossers-filterrow'>" + tdset + "</tr>";
$(tr).insertAfter(this);
});
//$("table.ms-listviewtable").children("thead").each(function () {
// alert('1');
// $(this).find("tr.vossers-filterrow").each(function () {
// alert('3');
// });
//});
};