-
Notifications
You must be signed in to change notification settings - Fork 754
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
Sort array with TableSorter like functions. #81
Comments
Hi vkostas! I like the idea, but my concern would be that a basic table would need to be set up to build the table. This is close to what the initialize tablesorter on an empty table demo does, but as you said you'd have to build a table first. I guess I could write an extension or something that will populate the internal table cache from an array, but it would still need to parse the data for the appropriate column, so it may not be as fast as you think. |
If you think this could be useful for others then I think it is worth giving it a try. |
You can use the replace accents function outside of tablesorter: var a = $.tablesorter.replaceAccents('Béjaïa'); // "Bejaia" And sure if you want to share the code for geek letter support, I would appreciate it. I actually think I'll add a wiki page to show how to extend the As for the array idea... I'll look into it. |
Hi Mottie, I already had tried that code but didn't work. That's why I wrote here. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head><title>Test replaceAccents</title>
<script type="text/javascript" src="../jquery/js/jquery.js"></script>
<script type="text/javascript" src="../jquery/js/jquery.tablesorter.js"></script>
</head>
<body>
<script type="text/javascript">
var s = $.tablesorter.replaceAccents('ë');
document.write('.........' + s + '.........');
</script>
</body></html> Error message "this.characterRegex is undefined" is raised from above code. Thank you for both issues. |
Ahhh ok, the characterRegex needs to be run first, i.e. set up a table first, before you can use the |
Ok, the replaceAccents function won't give you an error anymore. I'm going to have to put this enhancement on a backburner for now.. at least until I've caught up fixing problems in some of my other projects. |
You deserve a great THANK YOU!!! |
Sorry, I should have updated this issue a while ago... basically, you can sort using any of the built-in sorting functions as follows: The following sort functions are currently available in v2.14+:
Use any of the above as follows: var array = [ /* a filled array */ ];
// ascending plain natural sort
array.sort(function(a,b) { return $.tablesorter.sortNatural(a,b); });
// descending plain natural sort
// array.sort(function(a,b) { return $.tablesorter.sortNatural(b,a); }); |
Hello,
I came through this nice plugin and started to use it.
I am building html pages of my media collection but I am running into performance issues. I build the output data and put in an 2 dimensional [200k x 40] Array within HTML file. Output table is build based on the literal data.
I find (almost) useless to build a HUGE table (8M cells) with all data then let tablesorter sort the whole thing and then start paging to show only a small part of it.
Sorting functionality is very clever but limited only to table elements.
Is there any way to use TableSorter functionality to prepare (sort) the array first? Performance will be boosted for sure.
Maybe I am doing something wrong? Something escaped my attention?
Thank you in advance.
The text was updated successfully, but these errors were encountered: