I'm implementing searches within a gridview using the "quicksearch" library which it's awesome.
I've used this library before and I never had any problems prior to this, when ever I try to use it I can't seem to make it work
I really hope someone can point me on what I might be doing wrong.
Here's the code:
<script type="text/javascript" src="../../../js/jquery.js" language="javascript"> </script>
<script type="text/javascript" src="../../../js/quicksearch.js" language="javascript"></script>
<script type="text/javascript" language="javascript">
$(function () {
$('.search_textbox').each(function (i) {
$(this).quicksearch("[id*=<%=dgridTest.ClientID%>] tr:not(:has(th))", {
'testQuery': function (query, txt, row) {
return $(row).children(":eq(" + i + ")").text().toLowerCase().indexOf(query[0].toLowerCase()) != -1;
}
});
});
});
My HTML page:
<asp:GridView
ID="dgridTest"
runat="server"
UseAccessibleHeader="true"
AutoGenerateColumns="False"
DataKeyNames = "Name"
PageSize="15"
OnRowCommand="dgridEmpleados_RowCommand"
Font-Size="Small"
BackColor="LightGoldenrodYellow"
BorderColor="Tan"
BorderWidth="1px"
CellPadding="2"
ForeColor="Black"
GridLines="None" >
<Columns>
<asp:TemplateField HeaderText="Name"
HeaderStyle-HorizontalAlign="Left" Visible="True">
<FooterTemplate>
<asp:Label
ID="lblNuemeroPer"
runat="server"
Text="">
</asp:Label>
</FooterTemplate>
<ItemTemplate>
<asp:Label
ID="lblNumPer"
runat="server"
CssClass="label label-success"
Font-Size="Small"
Text ='<%#Bind("Name") %>'>
</asp:Label>
</ItemTemplate>
<HeaderStyle HorizontalAlign="Left"></HeaderStyle>
<HeaderTemplate >
<asp:Label
ID="lblsearch "
runat="server"
Text="No. Permiso">
</asp:Label>
<input id="txtSearch "
type="text"
class="search_textbox"
maxlength="30"
style="color:#777777;
width:150px;
background-image:url(../../Images/Search.png); background-position:right;
background-repeat:no-repeat;" />
And when ever I try to search for something, nothing comes up.
$(function ()
{
$('.search_textbox').each(function (i) {
$(this).quicksearch("[id*=dgridTest] tr:not(:has(th))", {
'testQuery': function (query, txt, row) {
return $(row).children(":eq(" + i +
")").text().toLowerCase().indexOf(query[0].toLowerCase()) != -1;
}
});
});
});
try this.....
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.