Comments (4)
Hi,
The timestamp was converted to a float
value because parseFloat('2015-08-25')
does not return a NaN
value. Since this is not expected behaviour and I was a bit upset with type inference in the current version, I created a new branch for testing (https://github.com/Holt59/datatable/tree/fix-datatype) in which:
- Non numeric values should not be converted to
float
(stronger inference) - You could specify
dataTypes
option to force type conversion:
var dt = new DataTable ('table-id', {
dataTypes: ['int', false, 'date', 'float', function (x) { return MyClass (x) ; }]
}) ;
Currently supported values are:
int
,float
,double
-parseInt
orparseFloat
- false,
string
,str
- No conversion (function (x) { return (x) } ;
) date
,datetime
- Convert toDate
object (function (x) { return new Date (x) ; }
)
You can also specify a function that will be used as a converter.
*Note: * I did not test this very intensively, so feel free to tell me if you have trouble using it!
from datatable.
Thanx for the reply. I see now the rendering of my text hid the spans, so here it is, spread out:
< span >$timestamp< /span >.
Le'ts see if that works in this situation (it worked in my code). Yes! Now for my reply.....
OK. As for specifying the dataTypes. I wanted to use that option, but could not understand the syntax. Does the array have 1 entry per column? If so, it's suit my purposes. I did try true and false, but they did not stop conversion, so I was confused. This makes me think I should try with a false in every element to stop all conversion, which is appropriate in my case.
Sigh: No, I have 9 columns and adding
'dataTypes': [false, false, false, false, false, false, false, false, false],
did not stop truncation. Now trying 9 of 'string'... Nope. Trying 9 of 'str'... Nope. Truncation is ruthless.
No matter. My span trick works :-).
from datatable.
Did you try using the version under fix-datatype
branch? There is no dataTypes
option in the master
branch. For the dataTypes
option you can either specify:
- One value per column (see my last post)
false
- No conversion at alltrue
- Auto conversion (behavior of the previous version)
If you don't want to use the fix-datatype
branch you can try setting the old forceStrings
option to true
:
var dt = new DataTable ('table-id', {
forceStrings: true
}) ;
// Same as (with the correct branch)
var dt = new DataTable ('table-id', {
dataTypes: false
}) ;
This will prevent any kind of conversion (it will even override dataTypes
option).
from datatable.
Hi Mikaël
On 26/08/15 17:26, Mikaël Capelle wrote:
Did you try using the version under |fix-datatype| branch? There is no
No, sorry. I should have made that clear.
|dataTypes| option in the |master| branch. For the |dataTypes| option
you can either specify:
- One value per column (see my last post)
- |false| | |'str'| | |'string'| No conversion at all
- |true| Auto conversion (behavior of the previous version)
OK! I was clearly using the wrong syntax.
If you don't want to use the |fix-datatype| branch you can try setting
the old |forceStrings| option to |true|:var dt= new DataTable ('table-id', {
forceStrings: true
}) ;This will prevent any kind of conversion (it will even override
|dataTypes| option).
You're right. That works.
So you can make my issue as not-a-bug.
Thanx for the replies.
Ron Savage - savage.net.au
from datatable.
Related Issues (20)
- IE 11: Pagination and filter not working correctly HOT 2
- Inject data to table row HOT 4
- Nullpointer Exception table with filter and no data
- Not working on my project :( HOT 6
- CSS not work HOT 4
- Extract filtered records HOT 11
- Filter outside the table HOT 2
- No idea how to make filter outside table HOT 1
- Get number of a table row. HOT 6
- Update table data HOT 19
- Process Ajax Data Before Displaying on Table! HOT 3
- Using Filter/Sort with hidden child rows HOT 3
- Question: How to search/filter multiple columns with one search field HOT 2
- Was cleared all attributes from td. HOT 1
- Click in a row event HOT 3
- Filter by date mm/dd/yyyy HOT 1
- Ajax Doesn't Work HOT 4
- filter is not function after apply addRows HOT 2
- Table reload method HOT 2
- how can i implement for rowspan ? HOT 3
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 datatable.