Jaima Joseph

Jaima Joseph

  • NA
  • 94
  • 107.3k

How to sort a column in a table in an MVC view

Jun 30 2014 7:21 AM

Hi,

I have to sort a column in my mvc view, on click of a small icon in the table header part ascending and descending order alternatively.

Any help??
 
I tried the following code ,

<style type="text/css">

table.sortable thead {

background-color: #eee;

color: #666666;

font-weight: bold;

cursor: default;

}

</style>

 

<script src="http://www.kryogenix.org/code/browser/sorttable/sorttable.js" type="text/javascript">

var newTableObject = document.getElementById("myTable")

sorttable.makeSortable(newTableObject);

</script>

..

<table id="myTable" style="width:100%" border="0" cellspacing="0" cellpadding="0" class="sortable">

 
But it is giving the following javascript error
 
0x800a01b6 - JavaScript runtime error: Object doesn't support property or method 'getAttribute' .
 
Please help.... 
 
 
 

Answers (5)