Asp.net mvc JQuery表筛选器无法与ASP.NET MVC页面上的插件一起使用
我有一个表,正在尝试使用uiTableFilter插件进行筛选,如下所示: 这里是JQuery函数:Asp.net mvc JQuery表筛选器无法与ASP.NET MVC页面上的插件一起使用,asp.net-mvc,Asp.net Mvc,我有一个表,正在尝试使用uiTableFilter插件进行筛选,如下所示: 这里是JQuery函数: <script type="text/javascript"> $(document).ready(function() { $table = $("#myTable").tablesorter({widthFixed: true, widgets: ['zebra']}); FilterText = ""; ColumnArray = ["Country"
<script type="text/javascript">
$(document).ready(function() {
$table = $("#myTable").tablesorter({widthFixed: true, widgets: ['zebra']});
FilterText = "";
ColumnArray = ["Country","Province/State"];
for (i=0;i<ColumnArray.length;i++) {
$("#myTable tbody tr").find("td:eq(" + i + ")").click( function() {
clickedText = $(this).text();
FilterText = ((FilterText == clickedText) ? "" : clickedText );
$.uiTableFilter( $table, FilterText, ColumnArray[i]);
});
}
});
</script>
<table id="myTable" class="tablesorter">
<thead>
<tr>
<th align="left">Transaction<br />ID</th>
<th align="left">Transaction<br />Date</th>
<th align="left">Name</th>
<th align="left">Email Address</th>
<th align="left">Products</th>
</tr>
</thead>
<tbody>
<% foreach (var item in Model) { %>
<tr id="<%= Html.Encode(item.TX_Id) %>">
<td><%= item.TX_Id %></td>
<td><%= String.Format("{0:g}", item.UpdatedOn) %></td>
<td><%= Html.Encode(item.AddressDetail.CustomerMaster.FullName()) %></td>
<td><%= Html.Encode(item.AddressDetail.Email) %></td>
<td><%= item.Document.Product.Name %></td>
</tr>
<% } %>
</tbody>
</table>
谢谢你的回复。我能看到你的代码和Bob博客中的代码之间唯一不同的地方就是行
$table = $("#myTable").tablesorter({widthFixed: true, widgets: ['zebra']});
分为两行,这一行:
$table = $("#myTable")
.tablesorter({widthFixed: true, widgets: ['zebra']});
在他的博客文章中是这样的,如果你查看他的例子/来源,在他的脚本中也是这样的
是的,我知道你在想什么,但是在Javascript中,空格有时很重要,特别是当它在行尾添加缺少的分号时。尝试不会有什么损失
$table = $("#myTable")
.tablesorter({widthFixed: true, widgets: ['zebra']});