custom text in sProcessing not showing when serverSide set to true

custom text in sProcessing not showing when serverSide set to true

tishadtishad Posts: 4Questions: 2Answers: 0

Hi, I am using a custom text in sProcessing option. It works in tables where serverSide is set to false but doesn't work in tables where serverSide is set to true. Changes in the sProcessing text are not reflected in the table, it keeps showing the old text. Any idea how to get around this strange behavior? Thanks in advance!

This question has an accepted answers - jump to answer

Answers

  • colincolin Posts: 15,238Questions: 1Answers: 2,599

    Hi @tishad ,

    The processing message is controlled by language.processing . Try changing that, and if no success, please could you provide a link to your page or a test page,

    Cheers,

    Colin

  • tishadtishad Posts: 4Questions: 2Answers: 0

    Hi @colin, thank for your reply. I tried changing sProcessing to processing in the language section but no luck. It's still the same. I am posting the initialization codes for two tables where it works and where it doesn't. Datatables version is 1.10.16
    Works here:

    function loadBiometricData() {
            $('#biometricTable').DataTable().destroy();
            $('#biometricTable').DataTable({
                "order": [[1, "asc"]],
                "info": false,
                "searching": false,
                "ordering": false,
                "paging": false,
                "processing": true,
                "lengthMenu": [10, 25, 50, 100],
                "dom": '<"top"i>rt<"bottom"lp><"clear">',
                "language": {
                    "sProcessing": "<span id=\"loading-image\" class=\"fa fa-spinner fa-spin fa-2x\" ></span>",
                    "sLengthMenu": "_MENU_ টা এন্ট্রি দেখাও",
                    "sZeroRecords": "আপনি যা অনুসন্ধান করেছেন তার সাথে মিলে যাওয়া কোন রেকর্ড খুঁজে পাওয়া যায় নাই",
                    "sInfo": "_TOTAL_ টা এন্ট্রির মধ্যে _START_ থেকে _END_ পর্যন্ত দেখানো হচ্ছে",
                    "sInfoEmpty": "কোন এন্ট্রি খুঁজে পাওয়া যায় নাই",
                    "sInfoFiltered": "(মোট _MAX_ টা এন্ট্রির মধ্যে থেকে বাছাইকৃত)",
                    "sInfoPostFix": "",
                    "sSearch": "অনুসন্ধান:",
                    "sUrl": "",
                    "oPaginate": {
                        "sFirst": "প্রথম",
                        "sPrevious": "পূর্ববর্তী",
                        "sNext": "পরবর্তী",
                        "sLast": "শেষ"
                    }
                },
                "ajax": {
                    "url": contextPath + "/servicebook/printBiometric/" + '${sbId}',
                    dataSrc: ''
    
                },
                "columns": [{
                        "data": "name"
                    }, {
                        "data": "value"
                    }],
                "columnDefs": [{
                        "targets": 1,
                        "data": "value",
                        "render": function (data, type, row, meta) {
    
                            if (data == null){
                                return '<img style=\'width:80px; height: 50px;\'  alt="no image available" src=" https://vignette.wikia.nocookie.net/pineapplepedia/images/3/3c/No-images-placeholder.png"/>';
                            }
                            return '<img style=\'width:80px; height: 50px;\'  src="' + 'data:image/jpeg/png;base64,' + data + '"/>';
                        }
                    }],
                "fnDrawCallback": function (oSettings) {
                    localizeBanglaInDatatable("biometricTable");
                }
            });
        }
    
    

    But it doesn't work here:

    $('#promotionListTable').DataTable().destroy();
     $('#promotionListTable').DataTable({
                    "processing": true,
                    "pageLength": 10,
                    "serverSide": true,
                    "bSort": true,
                    "pagingType": "full_numbers",
                    "dom": '<"top"i>rt<"bottom"lp><"clear">',
                    "bAutoWidth": true,
                    "columnDefs": [
    
                        {className: "dt-center", targets: '_all'}
                    ],
                    "language": {
                        "processing": "<span id=\"loading-image\" class=\"fa fa-spinner fa-spin fa-2x\" ></span>",
                        "url": urlLang
                    },
                    "ajax": {
                        "url": path + "/promotion/list",
                        "type": "POST",
                        "data": {
                            "servicebookId": $("#servicebookId").val(),
                            "name": $("#name").val(),
                            "status": $("#promotionStatus :selected").val()
                        }
                    },
                    "fnDrawCallback": function (oSettings) {
                        showModalDialog();
                        if (selectedLocale === 'bn')
                        {
                            localizeBanglaInDatatable("promotionListTable");
                        }
                    }
                });
    
  • allanallan Posts: 63,331Questions: 1Answers: 10,436 Site admin
    Answer ✓

    You'll need to include the processing translation in your urlLang file. Somewhat counterintuitively the client-side designed strings will be overwritten by the url source strings. This is a deficency that will be correct in the next major release.

    Allan

  • tishadtishad Posts: 4Questions: 2Answers: 0

    Thanks Allan, finally got around it after changing the string in urlLang file.

This discussion has been closed.