Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature request: Including sort order parameter in ajaxUrl #155

Closed
trevorbernard opened this issue Oct 15, 2012 · 8 comments
Closed

Feature request: Including sort order parameter in ajaxUrl #155

trevorbernard opened this issue Oct 15, 2012 · 8 comments

Comments

@trevorbernard
Copy link

I'm running into an issue where I want sort to be applied on the whole dataset and not just the particular page I'm on when I'm using ajax and pagination.

@thezoggy
Copy link
Collaborator

just pass the param to your app that serves up the content?

@trevorbernard
Copy link
Author

Yup that's what I want to do but there is a little bit of work to get it working.

https://github.com/Mottie/tablesorter/blob/master/addons/pager/jquery.tablesorter.pager.js#L250

The library would have to know about it.

@Mottie
Copy link
Owner

Mottie commented Oct 15, 2012

Hmm, so you'd need the column and direction (0 = desc, 1 = asc) added?

So the URL would have to look something like this?

// sortList
[ [0,0], [1,0] ]

// url
col[0]=0&col[1]=0 

@trevorbernard
Copy link
Author

Yup, something like that

@Mottie
Copy link
Owner

Mottie commented Oct 15, 2012

Ok cool. I'll look into add something like this soon.

@Mottie
Copy link
Owner

Mottie commented Oct 17, 2012

Hi @trevorbernard!

Tell me what you think of the parameter I added. Basically you add this to the url {sortList:xyz}, where xyz is the parameter name to add to the url. So this url string

"http://mydatabase.com?page={page}&size={size}&{sortList:xyz}"

that has page number of 2, size of 10 and a sortList value of [[2,0],[3,0]] becomes

"http://mydatabase.com?page=2&size=10&xyz[2]=0&xyz[3]=0"

If no sort is applied to the table, the url string will only return parameter name:

"http://mydatabase.com?page=2&size=10&xyz"

@trevorbernard
Copy link
Author

Looks good. I won't have time to test it out until tomorrow morning though.

@four43
Copy link

four43 commented Oct 17, 2012

You guys are on this, awesome. I've been looking into extending the AJAX portion of the pager plugin to handle more REST-style parameters and sorting. Glad to see there is other interest in this as well.

@Mottie Mottie closed this as completed Nov 1, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants