$(function () { GetTableEleve(); }); function GetTableEleve() { $.ajax({ type: "POST", url: "/TableFullOption/WebForm2.aspx/GetlstEleve", contentType: 'application/json; charset=utf-8', dataType: "json", success: function (msg) { if (msg.d.Retour.Reussi == true) { if (msg.d.LstElev != null && msg.d.LstElev.length > 0) { BuildTableElev(msg.d.LstElev); } } else { AfficheMsgRetour(msg.d.Retour); } }, error: function () { var Ret = { Reussi: false, Titre: "Liste des élèves", Msg: "Erreur accès fonction." }; AfficheMsgRetour(Ret); } }); } function BuildTableElev(msg) { var tbody = ''; $tbody = $('#large').find('tbody'); for (var post=0; post < msg.length; ) { tbody += '' + msg[post].Name + ''; tbody += '' + msg[post].Major + ''; tbody += '' + msg[post].Sex + ''; tbody += '' + msg[post].English + ''; tbody += '' + msg[post].Japanese + ''; tbody += '' + msg[post].Calculus + ''; tbody += '' + msg[post].Geometry + ''; tbody += ''; post++; } $row = $(tbody); // resort table using the current sort; set to false to prevent resort, otherwise // any other value in resort will automatically trigger the table resort. resort = true; $tbody.append($row).trigger('addRows', [$row, resort]); //$('#large').trigger("update").trigger("appendCache").trigger("applyWidgets"); }