Home & blog  /  Tag: table  /

Roundup: animated table sort / browser sniffing

posted: 07 Nov '11 07:04 tags: table, sort, animation, browser, sniff, plugin, navigator

With the exception of Blockster, the most popular script I've ever posted is my animated table sorter.

Which is rather odd, since as far as I'm aware it's buggy. Somehow, though, if the comments and e-mails are anything to go by, loads of people have been able to use it just fine.

Given this unexpected popularity I'm going to attempt to rebuild it in the coming months.

This script is among the top five hardest scripts I've written, so I'll, er, look forward to that.

In other news, stay tuned for my next script, later this week - a browser and plugin sniffer.

Browser sniffing is one of those things that you can't believe there still isn't a standard way of doing. Even jQuery's $.browser utility comes with a load of caveats warning that results might not be as expected.

And it's little wonder. Different browsers declare different, non-standard data in the various properties of the navigator object. Over the years these have led to some amusing revelations; if you ask Chrome what its navigator.appName is you'll get... Netscape. Naturally.

So I've been labouring away on a script that will provide you with something representing a reliable utility for this sort of thing. Not only with regards to detecting browser name but also other info such as language (more on that later...) and plugin support (and on that...).

post a comment

Table sorter: toggling sort direction

posted: 20 Nov '10 21:11 tags: table, sort, Saul, community

A quick thanks to Saul, who took an interest in my table sort script and developed a way to toggle the sort direction when a column heading is re-clicked. That is, the first time it's clicked the table column is sorted in ascending order; if clicked again, in descending order.

For full details, check out Saul's comment on the script page over here.

post a comment

Table sort update - sorting on child element

posted: 17 Jul '10 13:01 tags: table, sort, animation, Javascript, jQuery, child

The reception to my animated table sort plugin, posted a few weeks ago, has been great. A number of blogs, articles and tweets have featured it.

Some people have asked if it's possible to sort on the content of a child element of each . It wasn't - but it now is, via a new parameter: child, which should be a selector string to match the element.

So if each in column 1 contained a text field, and you wanted to sort on the current values of those textfields, you'd could run:

1$('#example1_table').sortTable({

2     onCol: 1,

3     keepRelationships: true,

4     child: 'input'

5});

It's important that your selector matches only one element per , else the sort will fail. If in doubt, be more specific with your selector, e.g.

child: 'input.mytextfield'

Head over here to download, get usage info or view a demo.

post a comment

Table sort - now REGEXP friendly

posted: 14 Jun '10 10:52 tags: table, sort, Javascript, jQuery, animation, REGEXP

Just modified my animated table sort plugin to allow sorting on a regular expression match against the content of each .

This would be hugely useful if, say, you had a table showing product categories and, for each, the number of products therein, in brackets, e.g. "Lawnmowers (15)".

You can also specify an index of the returned matches array to use for the sort, in case your REGEXP pattern returns more than one match or specifies a sub-pattern.

Head over here to download, get usage info or view a demo.

post a comment