Datatables 2.1 - Issue with Boolean value in table.draw()
Datatables 2.1 - Issue with Boolean value in table.draw()
![Torsten Holzbrecher](https://secure.gravatar.com/avatar/99a43512562230b3b9c6c86aa10b0122/?default=https%3A%2F%2Fvanillicon.com%2F99a43512562230b3b9c6c86aa10b0122_200.png&rating=g&size=120)
Unfourtunaly I can't provide a test case, as it is a closed system.
We are returning a http Webrequest as Object.
'HasAPI': data[index].HasAPI,
'IsGlobal': data[index].IsGlobal,
'IsMaster': data[index].IsMaster,
'IsSSO': data[index].IsSSO,
All are boolean values (true, false) in the object.
Comment: ""
CountryGUID: "d242ab9e-1f8d-4da5-b363-702843f7b259"
GUID: "78ad6004-269b-4c4f-9cf4-c3d1db552b51"
HasAPI: false <--- Boolean
IsSSO: true <--- Boolean
IsMaster: true <--- Boolean
IsGlobal: true <--- Boolean
Error:
TypeError: t.replace is not a function
at L (dataTables.min.js:4:9187)
at c (dataTables.min.js:4:776)
at oneOf (dataTables.min.js:4:83993)
at st (dataTables.min.js:4:17847)
at d (dataTables.min.js:4:26228)
at X.<anonymous> (dataTables.min.js:4:52094)
at X.iterator (dataTables.min.js:4:47201)
at X.<anonymous> (dataTables.min.js:4:52049)
at X.draw (dataTables.min.js:4:48481)
When converting the data into a string, the table.draw() is working:
table.rows.add(
[
{
'HasAPI': data[index].HasAPI
}
]
Workaround -> 'HasAPI': String(data[index].HasAPI) it is working for all Boolean values.
Forgot: In Version 2.0.8 it is working, the issue appeared after update to 2.1
Replies
I've managed to create it in a little test case: https://live.datatables.net/ruholezu/1/edit .
Many thanks for letting me know about this. I'll get a fix committed shortly (hopefully later today all being well) and a new release out in the next few days. Will post back in this thread when a fix is committed.
Allan
Hi, Allan,
I'm having this issue with Version 2.1.2.
Your test case is using the nightly builds and it works.
I updated your test case to use Version 2.1.2 and reproduced the issue.
<link href="https://cdn.datatables.net/v/dt/dt-2.1.2/datatables.min.css" rel="stylesheet" type="text/css" />
See the test case at:
https://live.datatables.net/ruholezu/4/
Thanks. This is the commit that fixed that issue. I'll get 2.1.3 out with that fix (and one for state saving) in the next few days.
Allan
There is still an issue in 2.1.3 with sorting of the boolean values. This was working in 2.0.8. I modified the example above to the latest version which fixes the boolean display. Click the Position column to sort. Notice it does not sort as expected. It looks like it is sorting every column except the one I am trying to sort.
https://live.datatables.net/ruholezu/8/
Thank you! Yes I agree - it was treating boolean data as "empty" and thus the sorting applied did nothing.
false
has always had that issue, but a recent change maketrue
fall into that camp as well, thus making it visible.This commit fixes that issue. It will be in 2.1.4, which I'll drop next week.
Regards,
Allan