Saturday 15 January 2011

javascript - dataTables jquery - how to add sorting image/icon? -


I use dataTables jquery I want to add a sorting image in the column and also want to change the image shd to the sorting. That is, if the image is showing the descending icon and clicking on it should be changed into the ascending icon Datatiles can be done using jquery?

My code:

  $ ("# rate"). True, "FNIT complete": function () {this.css ("visibility", "visible", "visible", "visible" ");}," Bilanti change ": wrong});    

  $ (document) .ready (function () True, "complete": function () {$ ("# TblVal"). Datasetable ("bPaginate": incorrect, "sScrollY": "250px", "batwdath": wrong, "biscroller pile" This.css ("visibility", "visible");}, "bLengthChange": incorrect}};});   
  & gt; html xmlns =" ​​http://www.w3.org/1999/xhtml ">  gt; title & gt; new document & lt; / title & Gt; & lt; sc Ript src = "https://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js" & gt; & lt; / script & gt; & lt; script src = "http: //code.jquery.com/ui/1.10.3/jquery-ui.js "> gt; & lt; / script & gt; & lt; script src =" http://ajax.aspnetcdn.com/ajax/ Jquery.dataTables / 1.9.4 / jquery.dataTables.min.js "& gt; & Lt; / Script & gt; & Lt; Link href = "http://ajax.aspnetcdn.com/ajax/jquery.dataTables/1.9.4/css/jquery.dataTables.css" rel = "stylesheet" /> & Lt; / Head & gt; & Lt; Body & gt; & Lt; Div id = "foo" & gt; & Lt; Table id = "tblVal" class = "data display dataset" & gt; & Lt; Thead & gt; & Lt; TR & gt; & Lt; Th & gt; S.no & lt; / Th & gt; & Lt; Th & gt; Id & lt; / Th & gt; & Lt; Th & gt; Name & lt; / Th & gt; & Lt; / TR & gt; & Lt; / Thead & gt; & Lt; Tbody & gt; & Lt; TR & gt; & Lt; TD & gt; 1 & lt; / TD & gt; & Lt; TD & gt; 100 & lt; / TD & gt; & Lt; TD & gt; VSA & lt; / TD & gt; & Lt; / TR & gt; & Lt; TR & gt; & Lt; TD & gt; 2 & lt; / TD & gt; & Lt; TD & gt; 101 & lt; / TD & gt; & Lt; TD & gt; Asa & lt; / TD & gt; & Lt; / TR & gt; & Lt; TR & gt; & Lt; TD & gt; 3 & lt; / TD & gt; & Lt; TD & gt; 102 & lt; / TD & gt; & Lt; TD & gt; National Food Security Act & lt; / TD & gt; & Lt; / TR & gt; & Lt; / Tbody & gt; & Lt; / Table & gt; & Lt; / Div & gt; & Lt; / Body & gt; & Lt; / Html & gt;     

Ensure that you have added a proper JS and CSS files. This code is working for me

  & Lt ;! DOCTYPE html PUBLIC "- // W3C // DTD XHTML 1.0 Transcription // N" http://www.w3.org/TR /xhtml1/DTD/xhtml1-transitional.dtd">?Ltml xmlns = "http : //www.w3.org/1999/xhtml "> gt; Top & gt; Title & gt; Title & gt; New Document & lt; / title & gt; & lt; script src =" http: / / /code.jquery.com/jquery-1.9.1.js "> gt; & lt; / script & gt; & gt; script src =" http://code.jquery.com/ui/1.10.3/jquery -ui.js ">