Putting datatable in a javascript function

Putting datatable in a javascript function

xilaxxilax Posts: 10Questions: 0Answers: 0
edited January 2014 in General
I need help with calling datatable from a global function. This is my code:

[code]
$(function () {
//Load dataTables only onclick
$(document.body).on("click", "a[data-table]", function(event) {
var table = $(this).attr('data-table');
var tbody = $("."+ table +" tbody");
if (tbody.children().length == 0) {
window[table]();
}
});
});
[/code]

the datatable in function

[code]

var ordersData;
ordersData = function(){
$(".ordersData").dataTable({
"bRetrieve": true,
"bAutoWidth": false,
"iDisplayLength": 10,
"aLengthMenu": [[10, 25, 50, -1], [10, 25, 50, "All"]],
"aaSorting": [],
"bSort": false,
"sPaginationType": "full_numbers",
"bProcessing": true,
"bStateSave": true,
"sAjaxSource": "<?php echo $gc['network']->getHttpSelf() . '?call=blaaaaaaaaaaaabla",
"aoColumns": [
{"bSortable": false},
{"bSortable": false},
{"bSortable": false},
{"bSortable": false},
{"bSortable": false},
{"bSortable": false},
{"bSortable": false},
{"bSortable": false},
{"bSortable": false},
{"bSortable": false}
],
"oLanguage": {
"sLengthMenu": "Display _MENU_ records per page",
"sZeroRecords": "No order record match found in the database.",
"sInfo": "Showing _START_ to _END_ of _TOTAL_ records.",
"sInfoEmpty": "Showing 0 record.",
"sInfoFiltered": "(filtered from _MAX_ total records)",
"sProcessing": "Loading order records, please wait..."
}
});
}

[/code]


Everything worked fine except this part below:

[code]

$(function(){
$('.reloadOrdersData').unbind("click").on('click', function(event){
var newAjaxSource = "theNewURLHere";
ordersData.fnReloadAjax(newAjaxSource);
event.preventDefault();
});
});

[/code]

the ordersData.fnReloadAjax(newAjaxSource); is throwinr error:

[quote]
TypeError: $(...).fnReloadAjax is not a function

$(".ordersData").fnReloadAjax(newAjaxSource);
[/quote]

What can I do to resolve this?
This discussion has been closed.