MyBB Internal: One or more warnings occured. Please contact your administrator for assistance.
Result filtering
Current time: 10-28-2020, 10:42 PM Hello There, Guest! (LoginRegister)

Post Reply 
 
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Result filtering
04-06-2009, 03:19 AM
Post: #1
Result filtering
(thread migrated from sourceforge forum - originally posted 8/16/2008)

Hi Pat,

Here's a simple jquery results filter which, if implemented, may be of benifit to other users:

Style:

Code:
fieldset {border:0 solid}
.even {background:#f7f7f7}


XHTML:

Code:
<form id="filter" action="#" onsubmit="filter(); return false;">
<fieldset>
<label for="filterTerm">Show only result URIs containing text:</label>
<input id="filterTerm" value="websemantics" type="text" />
<input id="submit" value="Filter" type="submit" />
<p id="results">Note filtering a large data set will take time.<br />
Narrow reports first: <a href="/testlog/1/">1 Day</a>, <a href="/testlog/7/">7 Days</a>, <a href="/testlog/30/">30 Days</a>, <a href="/testlog/182/">6 Months</a>, <a href="/testlog/365/">1 Year</a>.</p>
</fieldset>
</form>

J

Code:
<script type="text/javascript" src="http://jqueryjs.googlecode.com/files/jquery-1.2.6.min.js"></script>
<script type="text/javascript">
/*<![CDATA[*/

function filter(){
var txt=$('#filterTerm').val(), total=0, count=0;
$('.url').each(function(){
total++;
if ($(this).text().match(txt)){
count++;
}else{
$(this).parent().remove();
}
})

$('#results').html('Showing <strong>'+count+'</strong> results from <strong>'+total+'</strong> entries.');
$('tbody tr:even').addClass('even');
$('#submit').val('Filter results further');
}

/*]]>*/
</script>

mike
Visit this user's website Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
Result filtering - pmeenan - 04-06-2009 03:19 AM
RE: Result filtering - pmeenan - 04-06-2009, 03:19 AM
RE: Result filtering - pmeenan - 04-06-2009, 03:19 AM
RE: Result filtering - pmeenan - 04-06-2009, 03:20 AM
RE: Result filtering - pmeenan - 04-06-2009, 03:20 AM

Forum Jump:


User(s) browsing this thread: 1 Guest(s)