asp.net mvc 4 - Need help in implementing tablesorter 2.17.1(or latest) -
asp.net mvc 4 - Need help in implementing tablesorter 2.17.1(or latest) -
can please help me working sample of mvc application tablesorter plugin applied ? bit confused how apply latest tablesorter plugin mvc sample..i trying implement
$('table').trigger('sortreset')
in below teble.
<table class="tablesorter"> <thead> <tr> <th>alphanumeric sort</th> <th>currency</th> <th>alphabetical</th> <th>sites</th> </tr> </thead> <tbody> <tr><td>abc 123</td><td>£10,40</td><td>koala</td><td>http://www.google.com</td></tr> <tr><td>abc 1</td><td>£234,10</td><td>ox</td><td>http://www.yahoo.com</td></tr> <tr><td>abc 9</td><td>£10,33</td><td>girafee</td><td>http://www.facebook.com</td></tr> <tr><td>zyx 24</td><td>£10</td><td>bison</td><td>http://www.whitehouse.gov/</td></tr> <tr><td>abc 11</td><td>£3,20</td><td>chimp</td><td>http://www.ucla.edu/</td></tr> <tr><td>abc 2</td><td>£56,10</td><td>elephant</td><td>http://www.wikipedia.org/</td></tr> <tr><td>abc 9</td><td>£3,20</td><td>lion</td><td>http://www.nytimes.com/</td></tr> <tr><td>abc 10</td><td>£87,00</td><td>zebra</td><td>http://www.google.com</td></tr> <tr><td>zyx 1</td><td>£99,90</td><td>koala</td><td>http://www.mit.edu/</td></tr> <tr><td>zyx 12</td><td>£234,10</td><td>llama</td><td>http://www.nasa.gov/</td></tr> </tbody> </table>
also js , css files referring follows
<head> <meta charset="utf-8"> <title>basic tablesorter demo</title> <link href="~/content/jq.css" rel="stylesheet" /> <link href="~/content/theme.default.css" rel="stylesheet" /> <script src="~/scripts/jquery-latest.min.js"></script> <script src="~/scripts/jquery-ui-1.8.24.min.js"></script> <script src="~/scripts/jquery.tablesorter.min.js"></script> <script src="~/scripts/jquery.tablesorter.widgets.min.js"></script> <script> $(function () { $('.tablesorter').tablesorter({ widgets: ['zebra', 'columns'], usnumberformat: false, sortreset: true, sortrestart: true }); }); </script>
not sure why not getting working..it thorows error "uncaught typeerror: undefined not function " tablesorter()
note: learned functionality of resetting available plugin 2.4.7 onward.
your help appreciated.
thanks
you'll need add together element on page allows user click reset sort. in this example, i'll utilize button:
<button type="button" class="reset">reset sort</button>
then apply appropriate script give button ability trigger reset event:
$(function () { $('.tablesorter').tablesorter({ widgets: ['zebra', 'columns'], usnumberformat: false, sortreset: true, sortrestart: true }); // create button reset sort $('.reset').click(function(){ $('.tablesorter').trigger('sortreset'); }); });
alternatively, user can utilize ctrl + left click on header cell reset sort. key can changed using sortresetkey
option.
asp.net-mvc-4 tablesorter
Comments
Post a Comment