Usually, the best place for sorting and filtering data is the database. But, sometimes, we need to work with the given data on the client side only. For example, filtering a simple contact list or sorting a small data grid. In this task, we will learn how to filter and sort data on the client side.
We will need the jQuery library:
<script src="js/jquery-1.4.4.js"></script>
We will also need a sample of data in JSON format from json/developers.json
:
[{ "fullname" : "Hefin Jones", "contactlocation" : "St David's, Wales", "labels" : "MS SQL, DBA" }, ... { "fullname" : "Raphaël Gabbarelli", "contactlocation" : "Rome, Italy", "labels" : ".Net(C#), Windows Phone 7" }]