News for hackers. Stuff that matters.
Re:Sort tables fast with Sortable.js by orware on Tuesday December 03, 2013 @01:09PM (#6841971)
I've been using the original sorttable.js you reference on your GitHub page for my own product for a number of years.

How does yours differ from that one in terms of features/capabilities?

Is it a rewrite with more modern techniques?

Re:Sort tables fast with Sortable.js by afschwartz on Tuesday December 03, 2013 @01:17PM (#6842022)
Yea, more-or-less.

Here is a short summary of some of the major changes:

– Tables with `data-sortable` attribute are automatically initialized.

– The sort arrows are made with CSS-border triangles instead of special characters.

– The sort arrows are always present but hidden for non-sorted columns so that columns don't resize when sorting.

– `sorttable_`-prefixed class names are now `data-` attributes, so they are valid HTML5.

– The library doesn't attempt to recognize date formats. Instead, it recommends you add `data-value="#{ timeInMillis }"` to your <td> containing a human-readable date string.

I'm sure there are more that I can't think of at the moment, but that's a decent list.

Re:Sort tables fast with Sortable.js by orware on Tuesday December 03, 2013 @01:45PM (#6842197)
Thanks for the replies guys, one additional question I had which I didn't see directly answered would be the type of browsers it should be compatible with or was tested on? The main page shows some browsers listed but I think that was simply demonstration data to show off the script and wasn't actually showing the versions it was supposed to support.
Re:Sort tables fast with Sortable.js by afschwartz on Tuesday December 03, 2013 @01:57PM (#6842283)
Browser support is listed in the documentation (http://github.hubspot.com/sortable): IE8+, Firefox 4+, Current WebKit (Chrome, Safari), Opera.
Re:Sort tables fast with Sortable.js by orware on Tuesday December 03, 2013 @02:06PM (#6842342)
Great, thanks! The Internet Explorer one was the one I was probably most curious about. I'll have to give it a test go and see if I can go ahead and use it to supplant the older sorttable in my script ;-).
Re:Sort tables fast with Sortable.js by zackbloom on Tuesday December 03, 2013 @01:21PM (#6842043)
I'm a little biased, but just from reading through, it looks like the original does some pretty out-of-date things. I'm annotating the copy in the new project's repo, just to allow me to link to line numbers, but this IS THE LEGACY PROJECT'S CODE:

- Webdings: https://github.com/HubSpot/sortable/blob/37894eb51bda9f0e438...

- Using class names, rather than data attributes, for everything: https://github.com/HubSpot/sortable/blob/37894eb51bda9f0e438...

- Hardcoded date formats which would make localization tough: https://github.com/HubSpot/sortable/blob/37894eb51bda9f0e438...

- Sorting in JavaScript (not using Array.prototype.sort): https://github.com/HubSpot/sortable/blob/37894eb51bda9f0e438...

- Overriding event bindings in a destructive manner: https://github.com/HubSpot/sortable/blob/37894eb51bda9f0e438...

Not to mention stuff I just find objectionable:

- Useless comments: https://github.com/HubSpot/sortable/blob/37894eb51bda9f0e438...

- Mistabbing: https://github.com/HubSpot/sortable/blob/37894eb51bda9f0e438...

It also looks like this one is 1/3 the length.

To be fair though, the original was written seven years ago, and still works, so it's not really fair to criticize it by modern standards. Suffice it to say that it was time for something new.