-
-
Notifications
You must be signed in to change notification settings - Fork 238
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
Record sort order in URL for auto-refreshing #439
base: master
Are you sure you want to change the base?
Conversation
@mterzo let me know if this is Ok so far. If so I will add a second parameter for ascending vs descending. |
We shouldn’t have to post back to the server on this. I haven’t had a chance to look but most JS sort library’s have a display to show and an actual value. For IPs we just need to conver them to their interfered value. |
I’m also looking into the larger scale installations where we are causing too many queries back to PuppetDB. If we don’t have to requery data we already have that would be helpful. Of course if we are paging the results the sort is on the result set not the entire data set. |
@mterzo this doesn't post back to the server I'm using an HTML5 feature that lets you update the URL without querying the website. https://developer.mozilla.org/en-US/docs/Web/API/History_API#The_pushState()_method Also this isn't related to the IP sorting. It is related to the fact that Puppetboard automatically refreshes every X seconds and forgets which column the user was sorting by. |
|
||
// When a table header is clicked update the URL without refreshing page | ||
$("th").click(function() { | ||
var newUrl = location.origin + location.pathname + "?sort=" + $(this).text(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would have to replace the above location.origin
with polyfill too.
// When a table header is clicked update the URL without refreshing page | ||
$("th").click(function() { | ||
var newUrl = location.origin + location.pathname + "?sort=" + $(this).text(); | ||
history.pushState({}, null, newUrl); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@mterzo this probably isn't compatible with older browsers. I'll do some more research this week.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It works for Internet explorer 👍
@mterzo can you please have a look at this? |
This works fine for me, but it only records the sort key, not the order ( |
This is a code snippet that allows the sort order to be controlled via a URL parameter set by clicking on a table header. #314