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

Clear Sorting #62

Closed
jbrooksuk opened this issue May 10, 2013 · 7 comments
Closed

Clear Sorting #62

jbrooksuk opened this issue May 10, 2013 · 7 comments

Comments

@jbrooksuk
Copy link

There should be an easy way to remove the sorting of a table.

@joequery
Copy link
Owner

Hm, hadn't considered this before. Thanks for the issue.

@jbrooksuk
Copy link
Author

I'm guessing you'd need to store the original sort somehow. 

Sent from Mailbox for iPhone

On Fri, May 10, 2013 at 9:34 PM, Joseph McCullough
notifications@github.com wrote:

Hm, hadn't considered this before. Thanks for the issue.

Reply to this email directly or view it on GitHub:
#62 (comment)

@joequery
Copy link
Owner

I'm not sure how this idea would be performance wise, but you could store the html of the table before you invoke the plugin, and then do a $("#mytable").html(oldTableHTML) whenever you want to get the original table back.

@jbrooksuk
Copy link
Author

Oh no, that can't be a good way of doing it. 

For now, since I'm using backbone I refresh my collection and the table gets redrawn which is useful since its multiple user based. 

Sent from Mailbox for iPhone

On Fri, May 10, 2013 at 9:46 PM, Joseph McCullough
notifications@github.com wrote:

I'm not sure how this idea would be performance wise, but you could store the html of the table before you invoke the plugin, and then do a $("#mytable").html(oldTableHTML) whenever you want to get the original table back.

Reply to this email directly or view it on GitHub:
#62 (comment)

@joequery
Copy link
Owner

I'm just thinking of ways to solve the problems without making modifications to the plugin. My goal is to keep the plugin as small and readable (and thus modifiable) as possible. I don't want to add in a new feature if it can be accomplished outside of the plugin itself.

@svivian
Copy link
Collaborator

svivian commented May 14, 2013

I don't know of any other plugins doing this.

One easy method to accomplish it though is to add a column to the left with a number for each row, i.e. 1, 2, 3, 4 and sort by that initially. Then the user can go back and sort by that to "reset" the table.

@DanielBadan
Copy link

DanielBadan commented Jun 15, 2016

May be a bit out of topic but if I'm correct the way where sort starts are event listeners of elements with data-sort event. How about creating an unique id on sort initialization and use it to name('click.id') events, then provide an destroy method...use the id to remove event listeners and clear rest of the stuff.

The problem that exists now is that without a destroy method, even after you delete the table from the DOM it still remains in the JS memory because of referencing from the plugin.
Here's a bit more info about that: https://developers.google.com/web/tools/chrome-devtools/profile/memory-problems/memory-diagnosis

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants