Flexigrid jQuery plugin: extending to allow sorting of static grids
Flexigrid is a nice lightweight jQuery plugin that turns tables into sortable, searchable, data-driven grids. It’s all ajaxed up to the hilt, like every other jQuery plugin, but it can also create a quick nice-looking grid from a plain ol’ HTML table.
Out of the box, though, its column sorting feature does not work unless your grid is hooked up to a server-side data source. Here is a svn patch that adds this functionality to the current head branch of flexigrid.js:
This patch is built on the current trunk revision of flexigrid.js, which is r3. I am currently unable to create a patch for the current release version (“1.0b3″), which is slightly different; but to apply these changes to that version is pretty simple, since I only made 3 changes:
- add “sortorder: ‘asc’” to the default properties struct up at the top
- add the “else if (!p.url) this.inPlaceSort();” clause to the end of the changeSort method
- copy in the inPlaceSort() function