Skip to content

Viewing entries tagged with 'mvc'

17 Aug 2011 by Stoo

An MVC Approach to Table Sorting

Sorting data is a useful feature for tabular data in any web app. This is much easier to do if you separate the underlying data from the HTML of the table. The simplest way to achieve this is to take an Model View Controller approach (or MV in our case as we won't need a controller) utilising the observer programming pattern. This will allow us to decouple the data (model) from the table (view). All the view really needs to know is what the data contains and when it changes, not how it was changed.