Info show wrong data

Info show wrong data

etha0ketha0k Posts: 8Questions: 1Answers: 0

I'm using datatable in MVC.
All work but info get wrong data showing "Showing 0 to 0 of 0 entries (filtered from NaN total entries)".
This my code:

$(document).ready(function () {
            $('#datatableClienti').DataTable(
            {   
                serverSide: "true",
                processing: "true",
                    "stateSave": true,
                    "paging": true,
                    filter: true,
                ajax: {
                        url: "/Cliente/ListaClienti",
                        type: "POST",
                        datatype: "json"
                        },
                        columns: [
                                { data: "id", name: "id",visible: false },
                                    { data: "ragioneSociale", name: "ragioneSociale"},
                                { data: "contatto", "name": "Contatto" },
                                    { data: "citta", "name": "Citta" },
                                    { data: "provincia", "name": "Provincia" },
                                    { data: "email", "name": "Email" }
                                ],
                                "columnDefs": [ {
                                           "targets": 1,
                                           "render": function ( data, type, row, meta ) {
                                                      return '<a target="_blank" href="Cliente/Edit/' + row.id +'">'  + data + '</a>';
                                           }
                                       }],
                        order:[0,"asc"],
                lengthChange: true,                    
                    dom: '<"container-fluid"<"row"<"col"B><"col"l><"col"f>>>rtip',
                    //dom: '<"dt-buttons"Bf><"clear">lirtip',
                    buttons: [{
                        text: 'Nuovo',
                        className: 'text-info',
                        action: function ( e, dt, node, config ) {
                            location.href = "Cliente/Nuovo/";
                            }
                         },
                        'searchPanes','copy', 'csv', 'excel', 'pdf', 'print'],
                    
                    keys: true
                    
            });            
        });

What's the problem?

Replies

  • etha0ketha0k Posts: 8Questions: 1Answers: 0

    I've found solution. Missing same parameter in the backend..

  • allanallan Posts: 62,484Questions: 1Answers: 10,262 Site admin

    Note also that serverSide: "true", should not be a string. Per the docs (serverSide) it should be a boolean. The same with processing.

    Allan

  • etha0ketha0k Posts: 8Questions: 1Answers: 0

    I was wrong to answer in the wrong place. I haven't solved it yet

  • allanallan Posts: 62,484Questions: 1Answers: 10,262 Site admin

    Happy to take a look at a test case showing the issue. My guess is that your server isn't sending back the data required since you are using server-side processing. Do you need it? Do you have tens of thousands of rows?

    Allan

  • etha0ketha0k Posts: 8Questions: 1Answers: 0

    Yes there are more than 250,000 record in my table. But table work well. Why shows 0 of 0..?

  • tangerinetangerine Posts: 3,365Questions: 39Answers: 394

    Happy to take a look at a test case showing the issue.

  • etha0ketha0k Posts: 8Questions: 1Answers: 0

    Found solution. I missed return some parameter

  • allanallan Posts: 62,484Questions: 1Answers: 10,262 Site admin

    Thanks for letting us know you've got it resolved.

    Allan

Sign In or Register to comment.