Home Page
Articoli
Tips & Tricks
News
Forum
Archivio Forum
Blogs
Sondaggi
Rss
Video
Utenti
Chi Siamo
Contattaci
Username:
Password:
Login
Registrati ora!
Recupera Password
Home Page
Stanze Forum
HTML, Javascript, CSS, DHTML, XHTML
[jquery datatable] .ajax.reload() non riconosciuto
mercoledì 21 gennaio 2015 - 13.27
Elenco Threads
Stanze Forum
Aggiungi ai Preferiti
Cerca nel forum
svipla
Profilo
| Senior Member
361
messaggi | Data Invio:
mer 21 gen 2015 - 13:27
Ciao a tutti
Ho questo codice che mi crea un datatable in un file esterno .js:
var TableManaged = function () {
return {
//main function to initiate the module
init: function () {
if (!jQuery().dataTable) {
return;
}
// begin table
oTable = $('#dtElenco').dataTable({
"oLanguage": {
"sUrl": "/Metronic/plugins/data-tables/language/it-IT.txt"
},
"aoColumns": [
{ "bSortable": false },
{ "bSortable": false },
null,
null,
null,
null,
null,
{ "bSortable": false }
],
"aaSorting": [[3, "asc"]],
"aLengthMenu": [
[5, 15, 20, -1],
[5, 15, 20, "Tutti"] // change per page values here
],
// set the initial value
"iDisplayLength": 5,
"sPaginationType": "bootstrap",
"aoColumnDefs": [
{ 'bSortable': false, 'aTargets': [0] },
{ "bSearchable": false, "aTargets": [0] }
]
});
jQuery('#dtElenco .group-checkable').change(function () {
var set = jQuery(this).attr("data-set");
var checked = jQuery(this).is(":checked");
jQuery(set).each(function () {
if (checked) {
$(this).attr("checked", true);
$(this).parents('tr').addClass("active");
} else {
$(this).attr("checked", false);
$(this).parents('tr').removeClass("active");
}
});
jQuery.uniform.update(set);
});
jQuery('#dtElenco').on('change', 'tbody tr .checkboxes', function () {
$(this).parents('tr').toggleClass("active");
});
jQuery('#dtElenco_wrapper .dataTables_filter input').addClass("form-control input-medium input-inline"); // modify table search input
jQuery('#dtElenco_wrapper .dataTables_length select').addClass("form-control input-xsmall input-inline"); // modify table per page dropdown
//jQuery('#dtElenco_wrapper .dataTables_length select').select2(); // initialize select2 dropdown
// ChangeStatus
$('#dtElenco').on('click', '[id*="btnStatus"]', function () {
var btnStatus = $(this);
var id = btnStatus.attr('data-id');
if ($.trim(id) != '') {
$.ajax({
url: '/Handler/ajaxOperation.ashx',
data: { type: 'changeStatusStrutturaContatto', id: id },
cache: false,
async: false,
dataType: 'json',
type: 'POST',
error: function (request, error) {
$('.alert-danger', $('.form-data')).show();
$('.alert-danger', $('.form-data')).find('span').html('Impossibile completare l\'operazione');
},
success: function (response) {
if (response.msg_error != '') {
$('.alert-danger', $('.form-data')).show();
$('.alert-danger', $('.form-data')).find('span').html(response.msg_error);
}
else {
oTable.api().ajax.reload();
//location.reload();
}
}
});
}
});
// fine ChangeStatus
}
};
}();
Quando eseguo oTable.api().ajax.reload(); (ho anche provato con oTable.ajax.reload(); e $('#dtElenco').dataTable().api().ajax.reload();) non fa nulla è ricevo questo errore:
TypeError: oTable.ajax is undefined
oTable.ajax.reload();
Prima utilizzavo oTable.fnReloadAjax(); su un altro template e non avevo problemi, ora utilizzo metronic e ho problemi.
da cosa può dipendere?
Grazie mille
Torna su
Stanze Forum
Elenco Threads
Partecipa anche tu! Registrati!
Hai bisogno di aiuto ?
Perchè non ti registri subito?
Dopo esserti registrato potrai chiedere
aiuto sul nostro
Forum
oppure aiutare gli altri
Consulta le
Stanze
disponibili.
Registrati ora !