jQuery plugin javascript


After a few projects of dealing with data tables, and being sick of complex implementations of sorting and filtering from the backend, I decided that I would do filtering from the front end.

My first instinct was to look for a library, hopefully a jQuery plugin, to handle this for me. After a first look, I found none of the table sort/filter solutions where what I needed. They either only did sort, only did filter, or did both but required you to use their own style. I wanted a plugin, I could just throw at a table, and it works, without heavily modifying the look of the table. So after a few hours of coming up short, I decided to take my first crack at writing a jquery plugin.

Now I have written instant filters before based on dropdowns or search fields, but I had always done it on fixed data sets. I had never written a sort function from the frontend before, so there were a few initial obstacles I had to overcome. First I launched a quick jetstrap.com project, and threw a table together. I like using jetstrap for development like this because it makes it look nice to start with, without any styling. It also allows me to keep my javascript separate and it comes with jquery included. After throwing together a quick set of helper functions, I got a basic sort/filter process down.

I then moved on to building it into a jquery library. There are many guides out there, but most of them are for contextual extensions of jquery objects. After finding out I was looking in the wrong place, I managed to get my first jquery plugin working. I then spent a few hours settings up the github repository and writing documentation for it. Now I officially have contributed to open source software!




August, 2013