Skip to content

Instantly share code, notes, and snippets.

@CootCraig
Created June 6, 2013 04:06
Show Gist options
  • Save CootCraig/5719236 to your computer and use it in GitHub Desktop.
Save CootCraig/5719236 to your computer and use it in GitHub Desktop.
ASP uiTableFilter examples
<%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
<!--#include file="../Connections/Inbound.asp" -->
<%
Dim debulk
Set debulk = Server.CreateObject("ADODB.Recordset")
debulk.ActiveConnection = MM_Inbound_STRING
debulk.Source = "SELECT debulk_last as 'Last', debulk_first as 'First', debulk_addr1 as 'Address 1', debulk_addr2 as 'Address 2', debulk_city as 'City', debulk_state as 'State', debulk_zip as 'Zip', debulk_complex as 'Apartment Complex' FROM dbo.debulk"
debulk.CursorType = 0
debulk.CursorLocation = 2
debulk.LockType = 1
debulk.Open()
Dim MaxFieldIndex
MaxFieldIndex = debulk.Fields.Count - 1
Dim FieldNames()
ReDim FieldNames(MaxFieldIndex)
For i=0 to MaxFieldIndex
FieldNames(i) = debulk.Fields(i).name
Next
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<script type='text/javascript' src='/base/jquery-1.10.1.min.js'></script>
<script type='text/javascript' src='/base/uitablefilter.js'></script>
</head>
<body>
<h1>Craig Working Here</h1>
<p><input id="filter_input" type="text" value="" /></p>
<table id="debulk_table">
<thead><tr>
<%For Each fld in FieldNames%>
<th><%=fld%></th>
<%Next %>
</tr></thead>
<tbody>
<% debulk.MoveFirst %>
<%Do While NOT debulk.Eof%>
<tr>
<%For Each fld in FieldNames%>
<td><%= debulk(fld) %></td>
<%Next %>
<tr>
<% debulk.MoveNext %>
<%Loop%>
</tbody>
</table>
<script type='text/javascript'>
$(document).ready(function() {
var tb = $('#debulk_table');
var inp = $('#filter_input').first();
$("#filter_input").keyup(function() {
var phrase = $(this).val();
$.uiTableFilter( tb, phrase );
});
});
</script>
</body>
</html>
<%
debulk.Close()
Set debulk = Nothing
%>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment