Cannot customize Search Box and Filter Box with css class when translating

Cannot customize Search Box and Filter Box with css class when translating

almperezalmperez Posts: 1Questions: 1Answers: 0
edited October 2017 in Free community support

Hi,

When I use translation the customization on both fiedls stop working. Can someone help me?
This is my code:

        $(document).ready(function () {
            $.ajax({
                url: "Default.aspx/generateData",
                type: "POST",
                dataType: "json",
                contentType: "application/json; charset=utf-8",
                success: function (retorno) {
                    $('#myTable').DataTable({
                        data: JSON.parse(retorno.d),
                        dom: "<'row'<'col-sm-6'l><'col-sm-6'f>>" + "<'row'<'col-sm-12'tr>>" + "<'row'<'col-sm-5'i><'col-sm-7'p>>",
                        language: {
                            url: 'https://cdn.datatables.net/plug-ins/1.10.16/i18n/Portuguese-Brasil.json'
                        },
                        createdRow: function (row, data, dataIndex) {
                            if ((data['dtencerramentoalerta'] == null) || (data['dtencerramentoalerta'] == '')) {
                                $(row).addClass("danger");
                            } else {
                                $(row).addClass("warning");
                            }
                        },
                        order: [[ 2, "desc" ]], 
                        columnDefs: [
                            { className: "text-center", "targets": [0, 1, 2, 3, 4] },
                            { orderable: false, "targets": [4] }
                        ],
                        columns: [
                            { 'data': 'column1' },
                            { 'data': 'column2' },
                            { 'data': 'column3' },
                            { 'data': 'column4' },
                            {
                                'data': null,
                                'fnCreatedCell': function (nTd, sData, oData, iRow, iCol) {
                                    $(nTd).html("<a href=test.aspx?data=" + oData.column5+ "><i class=\"fa fa-area-chart fa-fw\"></i></a>");
                                },
                                'bSearchable': false
                            }
                        ]
                    });
                },
                complete: function () {
                    $('div.dataTables_filter input').addClass("form-control");
                    $('div.dataTables_filter input').addClass("input-sm");
                    $('div.dataTables_length select').addClass("form-control");
                    $('div.dataTables_length select').addClass("input-sm");
                }
            });
        });

If I remove the following lines the css classess are applied successfully:

language: {
    url: 'https://cdn.datatables.net/plug-ins/1.10.16/i18n/Portuguese-Brasil.json'
},

Cheers

This discussion has been closed.