Crystal
Crystal

Reputation: 29458

Microsoft JScript runtime error: Object doesn't support property or method 'tablesorterPager'

I'm just getting started with ASP.NET/MVC3, jquery, c#, you name it. I'm trying to follow this tutorial: http://weblogs.asp.net/hajan/archive/2011/02/09/table-sorting-amp-pagination-with-jquery-in-asp-net-mvc.aspx

I got the sorting to work, but when I try to add pagination, I get the error:

Microsoft JScript runtime error: Object doesn't support property or method 'tablesorterPager'

In the bottom of my Index.cshtml page for the first view that is seen on the webpage, I have this:

<script type="text/javascript">
    $(document).ready(function () {
        $("#tbMyRequests").tablesorter({
                headers: {
                    8: {
                        sorter: false
                    }
                }
            }
        ).tablesorterPager({ container: $("#pager") });
    });
</script>

It breaks on the .tableSorterPager line with the error message I mentioned earlier. When I looked at what could be causing that error, I saw some people saying that there might be two copies of the same jquery library conflicting with each other. I don't see a problem initially, but like I said, total noob. At the top of this page, I include these libraries:

<script src="@Url.Content("~/Scripts/jquery-ui-1.8.11.min.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/jquery.tablesorter.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/jquery.tablesorter.pager.js")" type="text/>javascript"></script>

I'm not sure if it's related, but in the _Layout.cshtml, I see this:

<script src="@Url.Content("~/Scripts/jquery-1.7.2.min.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/modernizr-1.7.min.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/jquery.unobtrusive-ajax.js")" type="text/javascript"></script>

Are these two libraries conflicting with each other? When I tried removing the 1.8.11.min.js from the Index.cshtml, I still get that error. Thanks.

Upvotes: 0

Views: 3204

Answers (1)

jmoerdyk
jmoerdyk

Reputation: 5520

Your script tag including the tablesorter.pager plugin has an extra > in the type field.

Upvotes: 2

Related Questions