Comments (9)
I’m fairly confident the issue is that Date.parse('1&1')
returns the current date in Chrome whereas Firefox returns NaN
. This is the imperfect criteria we use to decide if a column contains “date” data. We could introduce an attribute data-sortable-type
which you could add to the th
to force a specific data-type to Sortable, with current options numeric
, alpha
and date
. For the time being though if you ensure that the entry in the first row of the “Host” column (call it foo
) have a value such that Date.parse(foo)
returns NaN
, you should see this issue resolve. Hope this helps!
from sortable.
Turns out someone already suggested this in #21. This should be closed as a duplicate.
from sortable.
(I’d close it myself but no longer have admin privileges for some reason.)
@timmfin @geekjuice @TrevorBurnham @graysky a little help here?
from sortable.
Thanks @timmfin
from sortable.
@adamschwartz I'm working on an implementation that allows selecting the sort order via data-*
attributes and also allows the user to add custom types and/or change how the types work. It has been pretty hard not to break BC and to keep the small footprint at the same time, but I think I'm getting there!
from sortable.
@felds Thanks, cool idea. Since window.Sortable.types
and window.Sortable.getColumnType
are already exposed, you could probably modify getColumnType
slightly and you’d be pretty close. Hope this helps.
from sortable.
@adamschwartz
I made so that each type test the data to see if it matches its definition. (felds@f28945f)
It works, but it's not that easy defining new types, as it's not an object, but an array (so pushing a new type would append it to the list, after the default one).
Converting the array to an obj flips the problem: we cannot trust the obj order when iterating through its keys and the default type could come first on the loop.
I think a solution could be adding a "priority" key to the type obj, converting the types obj into an array before looping and then sorting by that property. Not that elegant, but I think that would work!
Any ideas?
from sortable.
Great idea! I think the array option is slightly better. See my couple comments, but I can’t wait to see the PR! Nice job. And thanks!
from sortable.
Ran into this issue (that as mentioned above only occurs in chrome) due to it thinking any number is with a string is a valid date. Has anyone found a way, other than data-sortable-types
in getting around Chrome's different way of dealing with Date.parse
/ new Date
's?
from sortable.
Related Issues (20)
- Publish sortable on npm HOT 2
- Only sorts the first tbody
- Sort handler triggered twice on mobile HOT 1
- first sorting column -- bug or feature? HOT 4
- no support for multiple header rows HOT 2
- trouble with manual install directions? HOT 1
- Sorting stops working once table is changed HOT 10
- make first column static HOT 2
- Mobile support HOT 5
- Money? HOT 1
- Locale Date field not sorting
- IE8 Compatibility
- Radio Input losing Checked status
- Sort fails for table inside table cell
- touch devices fires sorting twice HOT 3
- Documentation
- Pagination and performance for larger datasets HOT 1
- 为什么使用ng-repeat出来的不能排序
- Sorting does not work with colspans in header
- Merge PRs
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from sortable.