2

I want to use Javascript to implement a datatable which can be reordered by clicking table head.

As I known jQuery and YUI have this plugin. But there's a further requirement that is user don't need to click table head but click another place out of table and the data table should be reordered normally.

Is there any suggestion?

2

3 Answers 3

0

Check out jqGrid

http://www.trirand.com/blog/

Sign up to request clarification or add additional context in comments.

Comments

0

You can use the simulate utility to get the stated behavior

Y.one("#node").simulate("click");

Here is more info on simulating event.

Comments

0

If you use jquery datatables you can do something like this in your click event:

var columnIndexToSort = 0,
    sortAcending = true;

$("#table").fnSort([[columnIndexToSort, sortAcending ? 'asc' : 'desc']]);

This will cause jquery datatables to sort and redraw the table for you. The jquery datatables plugin is very powerful and I find it harder to find something it can't do rather than something it can.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.