Comments (5)
I had the same problem, because file sizes where formatted server-side.
However I found looking at the sources of the sort function of Simple-DataTables [1] that it can use an attribute "data-content" to sort data instead of the content of the cell which includes KB, MB, ...
So I've put the bytes file size in this attribute and now the sort uses it (note that I count 1024 bytes in 1 KB) :
<td data-content="162155197" align="right">154.6 MB</td>
It'd be nice if it appeared in the wiki !
from simple-datatables.
Is this a feature you would like to program @weilinzung ? If so, we could add it.
from simple-datatables.
Hello,
I've been dealing with similar issue for an hour before eventually finding this thread, which greatly helped me. Thanks to you all.
So commenting here for search engines: data-content in Simple-Datatables is equivalent to DataTables data-sort or data-order
EDIT April 2024: The answer above was valid for simple-datatables < 6.0.0
When using a version >= 7.0.3, you must use data-order
, as described in Getting started
from simple-datatables.
How do you actually set the data-content-value? I tried to set it after datatable.rows().add() but it gets cleared after sorting the column.
from simple-datatables.
My HTML is generated server side, so data-content come from there.
from simple-datatables.
Related Issues (20)
- [BUG] Strange filtering problem HOT 2
- [BUG] Cant get Template to work... HOT 1
- [REQUEST] Row Group
- multiSearch not working for me HOT 5
- Title/field headings HOT 5
- Support for colgroup
- [BUG] init() method has no options parameter anymore? HOT 6
- events cannot be fired in the chrome environment HOT 2
- [BUG] A form field element should have an id or name attribute - HTML validity
- [BUG] Can't sort numeric columns
- [BUG] Columns.hide() and show() don't work with integer values
- Responsive Mobile HOT 8
- [BUG]`TypeError: Cannot read properties of undefined (reading 'settings')` at re insert table in version ^9.0.0 HOT 4
- [Feature Request] Ability to hide rows HOT 6
- [BUG] searchQuerySeparator not working via CDN HOT 2
- [BUG] columns property not properly generated HOT 2
- [BUG] Destroying and removing the table element is not working correctly HOT 1
- [BUG] data-order HOT 1
- [BUG] attribute data-sort not working in <th> HOT 2
- Sorting with empty cells doesn't work correctly.[BUG] HOT 2
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 simple-datatables.