0

I am very new in jquery. I want to sorting on table i will explain the scenarios I have HTML Table where has 4 columns, Documents, Language, Date, Format. Now want to sort the first column Document and within document sort by Language when page is loaded Can anyone help me on this?

this is the HTML

<table id="Sorting">
<tbody>
<tr>
<td>Documents</td>
<td>Language</td>
<td>Date</td>
<td>Format</td>
 </tr>
<tr>
<td>Document1</td>
<td>English</td>
<td>01/01/2012</td>
<td>PDF</td>
</tr>
<tr>
<td>Document2</td>
<td>French</td>
<td>01/01/2012</td>
<td>PDF</td>
</tr>
<tr>
<td>Document3</td>
<td>Dutch</td>
<td>01/01/2012</td>
<td>PDF</td>
</tr>
<tr>
<td>PDFDoc1</td>
<td>German</td>
<td>01/12/2012</td>
<td>XSL</td>
</tr>
<tr>
<td>PDFDoc2</td>
<td>English</td>
<td>01/01/2012</td>
<td>PDF</td>
</tr>
<tr>
<td>PDFDoc3</td>
<td>Norwegian</td>
<td>01/01/2012</td>
<td>PDF</td>
</tr>
<tr>
<td>Document4</td>
<td>Spanish</td>
<td>01/01/2012</td>
<td>PDF</td>
</tr>
<tr>
<td>Document5</td>
<td>Dutch</td>
<td>01/01/2012</td>
<td>PDF</td>
</tr>

</tbody>

</table>

1 Answer 1

1

I would use the DataTables plugin if I was you.

"DataTables is a plug-in for the jQuery Javascript library. It is a highly flexible tool, based upon the foundations of progressive enhancement, which will add advanced interaction controls to any HTML table."

Even though you are new to jQuery, and the prospect of using a plugin might intimidate you, trying to write all this table-sorting stuff yourself would be harder. I've used DataTables - it's relatively straightforward to use, and the docs are really extensive.

Sign up to request clarification or add additional context in comments.

2 Comments

Thanks for quick answer, but i can't use any plugins in my requirement, this sorting needs to be when page loaded. is there any other help which can easily be done? thanks for your quick help
Why can't you use a jQuery plugin? It's just another Javascript file, like jQuery itself is. It's not some other type of technology. You just download it, and link to it, then use references to it in your Javascript and HTML files.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.