Quantcast
Channel: Recent Discussions — DataTables forums
Viewing all articles
Browse latest Browse all 82258

sAjaxSource

$
0
0
Hello,

I have this situation:
1.- I use Codeigniter.
2.- I've modified the CodiIgniter Table class adding dataTable function, so:

class MY_Table... { 
       function getTable( ){...}
}

3.- In each one of my controllers (they are various), there are functions:

class Controller... { 
       public function index( ){....}

       public function modify( ){....}

       public function getTable()
        {
        $this->load->library('table');

        $this->table->getTable( );
        }
}

4.- I use the javascript file jquery.dataTables.min.js and jQuery


when i use the function dataTable and i write the value for parameter 'sAjaxSource', this function take this value and get another considering it.
For example:

$('#tablaRegistros').dataTable({
        "bProcessing": false,
        "bServerSide": true,
        "sServerMethod": "POST",
        "sAjaxSource": "getTable",
        "iDisplayLength": 20,
        "aLengthMenu": [[10, 25, 50, -1], [10, 25, 50, "All"]],
        "aaSorting": [[0, 'asc']],
        "aoColumns": [
        { "bVisible": true, "bSearchable": true, "bSortable": true },
        { "bVisible": true, "bSearchable": true, "bSortable": true },
        { "bVisible": true, "bSearchable": true, "bSortable": true },
        { "bVisible": true, "bSearchable": true, "bSortable": true },
        { "bVisible": true, "bSearchable": true, "bSortable": true },
        { "bVisible": true, "bSearchable": true, "bSortable": true },
        { "bVisible": true, "bSearchable": true, "bSortable": true },
        { "bSearchable": false,
            "bSortable": false,
            "mRender": function (data) {
                return '<a href="modify/'+data+'">M</a><a href="delete/'+data+'">E</a>';
            }
          }
        ]
    }).fnSetFilteringDelay(700);

the value for 'sAjaxSource' was 'getTable'. When .js it's call from controller->index( )(the url shows like http://localhost/proyect/controller) there isn't problem, because the ajax called was "http://localhost/proyect/controler/getTable".

But when it's called from controller->modify, (another function from controller and the urls shows like http://localhost/proyect/controller/modify) there is a problem because the ajax called was "http://localhost/proyect/controler/modify/getTable&quot; and it doesn´t exist.

I don't find where the problem is when I use the code. Can someone help me, please?

Thanks a lot!

Viewing all articles
Browse latest Browse all 82258

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>