Hi all,
I am doing my application in MVC project. I am implementing the paging concept in my search result page. I have added the script for paging. but while running the application script is not loading in my console.
I have share my code below
<div id="sortMsg" style="text-align:center;color:Red;"></div>
<table border="1" id="empTable" style="width:50%;removed:default">
@if (Model != null)
{
if (Model.Count() != 0)
{
<tbody>
@foreach (var item in Model)
{
<tr>
<td>
<div class="tiptext">
"font-size: large; color: rgba(26, 13, 178, 1)" class="description" src="~/Images/popup_pointer.jpg"__^
</div><hr />
<div class="description_body">
^__b__^Description </b__^<h4 class="des">@item.BusinessDescription</h4>
^__b__^Address2 <h4 class="des">@item.Address1</h4>
^__b__^Email <h4 style="color:blue; margin: 5px 0px 5px 0px;">@item.EmailID </h4>
^__b__^WorkNumber <h4 class="des">@item.WorkNumber</h4>
^__b>MobileNumber <h4 class="des">@item.MobileNumber</h4>
^__b>City <h4 class="des">@item.City</h4>
^__b>State <h4 class="des">@item.State</h4>
^__b>ZipCode <h4 class="des">@item.ZipCode</h4>
@Html.ActionLink("Book An Appointment", "CalendarView", "Appt", new { id = @item.UserID }, null)
</div>
</div>
</div>
</div>
</div>
</div>
</td>
</tr>
}
</tbody>
}
else
{
<label id="lblErrorMsg" title="Record not fount...!" style="color:red;">Record not found...!</label>
}
}
</table>
</div>
</div>
<hr />
<div id="pager" class="pager">
<br />
<img src="~/Content/first.png" class="first" />
<img src="~/Content/prev.png" class="prev" />
<input type="text" class="pagedisplay" />
<img src="~/Content/next.png" class="next" />
<img src="~/Content/last.png" class="last" />
<select class="pagesize">
<option selected="selected" value="10">10</option>
<option value="20">20</option>
<option value="30">30</option>
<option value="40">40</option>
</select>
<script type="text/javascript">
$(function () {
debugger;
$("#empTable")
.tablesorter({ widthFixed: true })
.tablesorterPager({ container: $("#pager") });
$("#empTable").bind("sortStart", function () {
$("#sortMsg").html('Sorting');
}).bind("sortEnd", function () {
$("#sortMsg").html('');
});
$("#empTable img").live("click", function () {
tablesorter_remove($(this).parent().parent(), $('#empTable'));
});
});
Array.prototype.remove = function (from, to) {
var rest = this.slice((to || from) + 1 || this.length);
this.length = from < 0 ? this.length + from : from;
return this.push.apply(this, rest);
};
function repopulateTableBody(tbl) {
debugger;
if ($.browser.msie) {
function empty() {
while (this.firstChild) this.removeChild(this.firstChild);
}
empty.apply(tbl.tBodies[0]);
} else {
tbl.tBodies[0].innerHTML = "";
}
jQuery.each(tbl.config.rowsCopy, function () {
tbl.tBodies[0].appendChild(this.get(0));
});
}
function tablesorter_remove(tr, table) {
debugger;
repopulateTableBody(table.get(0));
var index = $("tr", table).index(tr);
var c = table.get(0).config;
tr.remove();
c.rowsCopy.remove(index);
c.totalRows = c.rowsCopy.length;
c.totalPages = Math.ceil(c.totalRows / config.size);
table.trigger("update");
table.trigger("appendCache");
index = c.page < c.totalPages - 1;
$(".next").trigger("click");
if (index)
$(".prev").trigger("click");
}
</script>