[jQuery] jQuery Column Filters Plugin Help
I just found the really great Column Filters Plugin:
http://plugins.jquery.com/project/ColumnFilters
Right now, you can only use it with tables, and, the tern you are
filter with, has to be the first thing within the <td>, so, if you
wanted to use a <span> inside, or a link this won't work. I am
interested in modifying it so that I can use it with lists, rather
than tables, and also allot other markup to be with in the <li> tag.
Has anyone used this plugin before?
Here is an example from the code, that I would like to modify:
function runFilters(event) {
$('input._filterText', obj).each(
function(iColCount) {
var wildCardPatt = new
RegExp(regexEscape(settings.wildCard),'g'),
sFilterTxt = (!settings.wildCard) ? regexEscape(this.value) :
regexEscape(this.value, settings.wildCard).replace(wildCardPatt,
'.*'),
bMatch = true;
if (settings.notCharacter &&
sFilterTxt.indexOf(regexEscape(settings.notCharacter)) === 0) {
sFilterTxt =
sFilterTxt.substr(regexEscape(settings.notCharacter).length,sFilterTxt.length);
if (sFilterTxt.length > 0) { bMatch = false; }
}
if (sFilterTxt.length < settings.minSearchCharacters) {
sFilterTxt = '';
}
sFilterTxt = sFilterTxt || '.*';
sFilterTxt = '^' + sFilterTxt + '.*';
$('tbody:first tr', obj).each(
function() {
$('td', this).each(
function(iCellCount) {
if (iCellCount === iColCount) {
var filterPatt = (settings.caseSensitive) ? new
RegExp(sFilterTxt) : new RegExp(sFilterTxt,"i");
$(this).removeClass('_match');
if (filterPatt.test($(this).text()) === bMatch) {
$(this).addClass('_match');
}
}
}
);
}
);
}
);