Home & blog  /  2010  /  Jul  /  view post  /

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 new comment

Comments (0)