How to use quicksearch jquery plugin for a particular column?
-
17-02-2021 - |
题
I have a gridview on which i want to apply quick-search plugin of jquery.I have implemented it successfully. But i want the search should be only according to a particular column, like:- I have three columns in a row. firstname, lastname, address. Now i want to search for firstname only.But normally quciksearch plugin is searching from whole gridview. I have done it from link :-http://www.misfitgeek.com/2011/06/filtering-an-asp-net-gridview-control-with-jquery/
Please help me as soon as possible. Thanks in advance.
解决方案 2
i know my code is not good technically its just completed my task. i am writing the code here
<script type="text/javascript">
$(document).ready(function() {
$("#ctl00_InnerBody_txtfirstnamesearch").quicksearch("table tbody tr", {
selector: 'span',
delay: 100,
loaderText: 'Loading...'
});
});
</script>
and in gridview :-
<asp:TemplateField HeaderText="First Name">
<ItemTemplate>
<asp:Label Text='<%# Eval("FirstName") %>' ID="lbl" runat="server">
</asp:Label>
</ItemTemplate>
</asp:TemplateField>
其他提示
You may define custom testQuery finction and filter by cell index in row:
$("#<%= SearchTextBox.ClientID %>")
.quicksearch("#<%= GridView1.ClientID %> tbody tr",
{
'testQuery': function (query, txt, row) {
return $(row).index() == 0 || // show header
$(row).children(":nth-child(3):contains('" + query[0] + "')").length > 0;
}
}
);
不隶属于 StackOverflow