Welcome Guest, Not a member yet? Register   Sign In
No Data Displaying
#1

[eluser]Unknown[/eluser]
Hello guys!!

3 days were passed and I could not solve my problem with the this awesome library.

I have a view with the table that will be load by a method. The JSON is ok, it's valid and if I check the firebug I can see the data changing if I search for a data.

Well, let me past the code.

VIEW:

Code:
<table id="tabela_estados" border="1" cellpadding="2" cellspacing="1" class="table table-striped table-bordered table-hover">
     <thead>
        <th>A</th>
        <th>B</th>    
        <th>C</th>
     </thead>
<table>
            [removed]
                     $(document).ready(function ()
                     {
                          var oTable = $("#tabela_estados").DataTable({
                               "bProcessing": true,
                               "bServerSide": true,
                               "sServerMethod": "POST",
                               "sAjaxSource": "/inicio/carrega_estados",
                               "bJQueryUI": true,
                               "bDeferRender": true,
                               "sPaginationType": "full_numbers",
                               "iDisplayStart ": 10,
                               "aoColumns": [
                                    {"sName": "id"},
                                    {"sName": "nome"},
                                    {"sName": "uf"}
                               ],
                               "oLanguage": {
                                    "sProcessing": ""
                               },
                               "fnServerData": function (sSource, aoData, fnCallback) {
                                    $.ajax
                                              ({
                                                   "dataType": "JSON",
                                                   "type": "POST",
                                                   "url": sSource,
                                                   "data": aoData,
                                                   "success": fnCallback
                                              });
                               }
                          });
                     });
            [removed]

Controller

Code:
function carrega_estados()
{
        $this->datatables
                ->select("id, nome, uf")
                ->from("estado");
        $data["json_response"] = $this->datatables->generate();
        $this->load->view("includes/v_response", $data);
}

VIEW: v_response
Code:
&lt;?php
echo json_response;

This is my JSON:

Code:

{"draw":0,"iTotalRecords":27,"iTotalDisplayRecords":27,"data":[["1","Acre","AC"],["2","Alagoas","AL"],["3","Amazonas","AM"],["4","Amapá","AP"],["5","Bahia","BA"],["6","Ceará","CE"],["7","Distrito Federal","DF"],["8","Espírito Santo","ES"],["9","Goiás","GO"],["10","Maranhão","MA"],["11","Minas Gerais","MG"],["12","Mato Grosso do Sul","MS"],["13","Mato Grosso","MT"],["14","Pará","PA"],["15","Paraíba","PB"],["16","Pernambuco","PE"],["17","Piauí","PI"],["18","Paraná","PR"],["19","Rio de Janeiro","RJ"],["20","Rio Grande do Norte","RN"],["21","Rondônia","RO"],["22","Roraima","RR"],["23","Rio Grande do Sul","RS"],["24","Santa Catarina","SC"],["25","Sergipe","SE"],["26","São Paulo","SP"],["27","Tocantins","TO"]],"sColumns":"id,nome,uf"}

If I set bServerSide = FALSE on the JS it only show "Loading..." (http://prntscr.com/4u64gn)

Informations:
Library version: 2.0
Jquery: 1.11
Datatable JS: 1.10.2

I don't know what to do, could anyone help me? Undecided




Theme © iAndrew 2016 - Forum software by © MyBB