Datatables 2.1 - Issue with Boolean value in table.draw()

Datatables 2.1 - Issue with Boolean value in table.draw()

Torsten HolzbrecherTorsten Holzbrecher Posts: 1Questions: 0Answers: 0
edited July 22 in Free community support

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

  • allanallan Posts: 63,498Questions: 1Answers: 10,470 Site admin

    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

  • TerraX3000TerraX3000 Posts: 7Questions: 1Answers: 1

    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/

  • allanallan Posts: 63,498Questions: 1Answers: 10,470 Site admin

    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

  • SickPuPSickPuP Posts: 13Questions: 6Answers: 0

    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/

  • allanallan Posts: 63,498Questions: 1Answers: 10,470 Site admin

    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 make true 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

  • TerraX3000TerraX3000 Posts: 7Questions: 1Answers: 1

    I think there is still an issue with filtering on boolean data in SearchPanes with Ajax data.

    See my test case here:
    https://live.datatables.net/bijupiku/5/

    The SearchPanes work for the other columns but there's no filtering for the boolean values.

    datatables v2.1.7
    select v2.1.0
    searchPanes v2.3.2

Sign In or Register to comment.