Hello,
I have a code (Javascript + C # + ASP.NET MVC 4) to perform an ajax call to the server and return an array with the information for the operation of the datatables. When executing the call to the server, everything happens normally and the response is generated and sent to the client. However, the datatables does not reload the new information. He remains empty with no results. There is no error in the request or response. There is no error in the formatting of the JSON response.
I researched several posts in the forum and not found a similar problem. I searched the documentation and several internet sites before posting here. I would like a little help to try to solve this problem which I can not find solution.
This link is for LIVE Execution for test case and see the problemn
http://200.98.203.38:9094/Basico/GrupoEmpresarial
Click on the Search button, one result is returned. Type Grupo in the Description field and click on Search button. Several results are returned. However, none of them are displayed in the table. There are no visible errors in the console.
-------------------------------------------------------------------
Below is the code
Table Code
Below is the JSON returned
I have a code (Javascript + C # + ASP.NET MVC 4) to perform an ajax call to the server and return an array with the information for the operation of the datatables. When executing the call to the server, everything happens normally and the response is generated and sent to the client. However, the datatables does not reload the new information. He remains empty with no results. There is no error in the request or response. There is no error in the formatting of the JSON response.
I researched several posts in the forum and not found a similar problem. I searched the documentation and several internet sites before posting here. I would like a little help to try to solve this problem which I can not find solution.
This link is for LIVE Execution for test case and see the problemn
http://200.98.203.38:9094/Basico/GrupoEmpresarial
Click on the Search button, one result is returned. Type Grupo in the Description field and click on Search button. Several results are returned. However, none of them are displayed in the table. There are no visible errors in the console.
-------------------------------------------------------------------
Below is the code
Table Code
<table id="tabela-pesquisa-grupo-empresarial" class="tabela-pesquisa"> <thead> <tr> <th class="td-width-40px"><input type="checkbox" name="check_All" value="" /></th> <th class="td-width-10">Código Grupo</th> <th >Descricao</th> </tr> </thead> <tbody> </tbody> </table>
$('#tabela-pesquisa-grupo-empresarial').dataTable({ "sPaginationType": "full_numbers", "bJQueryUI": false, "bAutoWidth": false, "bLengthChange": false, "bFilter": false, "bProcessing": true, "bServerSide": true, "sAjaxSource": "GrupoEmpresarial/Pesquisar", "sServerMethod": "POST", "aoColumns": [ { "bSortable": false, "bSearchable": false }, { "mDataProp": "IDGrupoEmpresarial" }, { "mDataProp": "Descricao" } ], "aoColumnDefs": [ { "sClass": "dt-column-align td-width-80", "aTargets": [2] } ], "fnServerData": function (sSource, aoData, fnCallback, oSettings) { oSettings.jqXHR = $.ajax({ "dataType": 'json', "contentType": "application/json; charset=utf-8", "type": "POST", "url": sSource, "data": GetDataPesquisa(aoData, oSettings), "success": fnCallback }); } });
Below is the JSON returned
{ "aaData" : [ { "Descricao" : "Grupo Teste 02", "IDGrupoEmpresarial" : 2 }, { "Descricao" : "Grupo Teste 03", "IDGrupoEmpresarial" : 3 } ], "iTotalDisplayRecords" : 2, "iTotalRecords" : 2, "sEcho" : 1, "success" : true }