sAjaxSource
sAjaxSource
Hello,
I have this situation:
1.- I use Codeigniter.
2.- I've modified the CodiIgniter Table class adding dataTable function, so:
[code]
class MY_Table... {
function getTable( ){...}
}
[/code]
3.- In each one of my controllers (they are various), there are functions:
[code]
class Controller... {
public function index( ){....}
public function modify( ){....}
public function getTable()
{
$this->load->library('table');
$this->table->getTable( );
}
}
[/code]
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:
[code]
$('#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 'ME';
}
}
]
}).fnSetFilteringDelay(700);
[/code]
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" 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!
I have this situation:
1.- I use Codeigniter.
2.- I've modified the CodiIgniter Table class adding dataTable function, so:
[code]
class MY_Table... {
function getTable( ){...}
}
[/code]
3.- In each one of my controllers (they are various), there are functions:
[code]
class Controller... {
public function index( ){....}
public function modify( ){....}
public function getTable()
{
$this->load->library('table');
$this->table->getTable( );
}
}
[/code]
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:
[code]
$('#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 'ME';
}
}
]
}).fnSetFilteringDelay(700);
[/code]
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" 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!
This discussion has been closed.