dom-checkbox and datetime-moment

dom-checkbox and datetime-moment

mvladomvlado Posts: 2Questions: 1Answers: 0

Hi,
When I use those two plug-ins on same table, dom-checkbox doesn't work. If I remove moment initialization, dom-checkbox work. Why is that and how to solve that?

This is my datatable initialization:
$(document).ready(function () {

        $.fn.dataTable.moment('DD/MM/YYYY HH:mm:ss');
        $.fn.dataTable.moment('MM/DD/YYYY HH:mm:ss');
        $.fn.dataTable.moment('DD/MM/YYYY');
        $.fn.dataTable.moment('MM/DD/YYYY');
        $.fn.dataTable.moment('DD.MM.YYYY HH:mm:ss');
        $.fn.dataTable.moment('MM.DD.YYYY HH:mm:ss');
        $.fn.dataTable.moment('DD.MM.YYYY');
        $.fn.dataTable.moment('MM.DD.YYYY');
        $('#DataTable').DataTable(
            {
                "columnDefs": [
                    {
                        "targets": [6, 7],
                        "orderDataType": "dom-checkbox"
                    },
                    {
                        "targets": [8,9],
                        "orderable": false
                    }
                ],
                "order": [[0, "desc"]]
            }
        );

    });

Thanx.

This question has an accepted answers - jump to answer

Answers

  • kthorngrenkthorngren Posts: 21,167Questions: 26Answers: 4,921
    edited March 2020 Answer ✓

    Interesting problem. Looks like the datetime-moment.js type detection sets a column with HTML a datetime data type. I took the CDN plugin code and put it in this example:
    http://live.datatables.net/yulemina/1/edit

    In the type detection for the code it strips the HTML then if the result is "" or null it types the column as datetime. However if you look at the code in the Datetime Sorting Bolg it doesn't strip the HTML.

    I see two choices; One is to use the code in the blog or use columns.type to text.

    Kevin

  • mvladomvlado Posts: 2Questions: 1Answers: 0

    Hi Kevin,

    Thanks a lot, i fix the problem. I use columns.type option as you do in example.

This discussion has been closed.