Here is the code snippet from one of my files:
function refreshGridSuccess(responseText, entity) {
oTable = $('#dataTable').dataTable({
"sScrollX": "100%",
In a different file, I have the following code:
$('#detailData')
.on('click', '.sort-up', function (event) {
event.preventDefault();
var column = $(this).closest('th'),
columnIndex = column.parent().children().index(column.get(0));
oTable.fnSort([[columnIndex, 'asc']]);
return false;
})
I have not explicitly defined the variable oTable
anywhere else. The scripts are functioning correctly, so does this mean that oTable
was automatically treated as a global variable?
Now, as I transition to using TypeScript, it prompts me to declare Otable
before using it. Is there a method to declare oTable
as an object, or do I need to specify its type based on what is returned by $('#dataTable').dataTable({})
?