Код: Выделить всё
$("#DATATABLE").DataTable({
serverSide: true,
filter: true,
searchDelay: 1000,
scrollY: StaticData.TABLE_HEIGHT + 'px',
lengthMenu: StaticData.TABLE_PAGE_SIZE,
language: { searchPlaceholder: "Stud Code, Stud Group" },
scrollCollapse: true,
ajax: {
url: '/STUD_MANAGEMENT/LoadStudents',
type: 'GET',
datatype: 'json',
headers: { 'RequestVerificationToken': 'your json token' },
data: (d) => {
return { draw: d.draw, start: d.start, length: d.length, search: d.search.value, FilterByColumn: d.columns[d.order[0].column].data, ASC_DSEC: d.order[0].dir }
},
beforeSend: () => { ShowLoader(); },
complete: () => { HideLoader(); },
dataSrc: (json) => {
json = json.data;
//console.log(json);
return json;
}
},
columnDefs: [{ className: "dt-center", targets: [0,2], width: '2%', }],
columns: [
{ data: 'STUD_ID', title: 'Stud Id', autoWidth: true, searchable: true },
{ data: 'STUD_GROUP', title: 'Student Group', autoWidth: true },
{ data: 'STUD_NAME', title: 'Student Name', autoWidth: true },
{ data: null, title: 'Class Model', autoWidth: true,
"render": function(data, type, row, meta){
if(type === 'display')
{
data = '' + data.CLASSMODEL + '';
}
return data;
}
}
]
}
});// datatable
Код: Выделить всё
function onDataModelClick(id) {
// alert(id);
}
Код: Выделить всё
StudNew.cshtmlПодробнее здесь: https://stackoverflow.com/questions/787 ... -datatable