-
Notifications
You must be signed in to change notification settings - Fork 178
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
Allow sort types to be included with Browserify #94
Comments
I was just looking to do the same thing. |
I had a conversation with @tristen about this on Twitter - the short term solution would be to use .extend to add the sort manually. Here's an example of how to do that for the "number" sort https://gist.github.com/tristen/e79963856608bf54e046 |
Excellent; thanks! |
Is this issue going to be resolved? |
still no news on this? |
One idea I could see taking is the monorepo approach using a tool like lerna. I think this would mean restructuring how the extend method works a little. I can jump on it when I have some spare time but would otherwise welcome a pull request. |
A fancy refactor would be neat, but I wonder if a much simpler solution would be just as good. @tristen how would you feel about simply adding oob support for all the sorts? In this day and age of |
Love the idea of this solution, but doing the following and have it technically work but not actually do anything is pretty disappointing: import TableSort from 'tablesort';
function setupTableSort(selector) {
document.querySelectorAll(selector).forEach(table => {
TableSort(table);
table.addEventListener('beforeSort', evt => {
console.log('Sorting table...');
});
table.addEventListener('afterSort', evt => {
console.log('Table sorted.');
});
});
}
document.addEventListener('DOMContentLoaded', evt => {
setupTableSort('.table.is-sortable');
}); Since there's already a |
I realize this isn't as trivial as I make it sound. The anonymous functions and global assumptions for "Tablesort" would have to be reworked. |
I managed to find a solution for including this fantastic script into my browserify build process.
By setting the required tablesort module back to the window you can then require the sort scripts you need from the node_modules directory. Builds and runs without issue. |
Currently you can require('tablesort') to get the basic functionality, but there's no way to require the additional sorting functions into a Browserify project.
The text was updated successfully, but these errors were encountered: