I am using jTable plugin for showing data in a MVC Application. I have set up table as below.
$(document).ready(function () {
$('#StudentTableContainer').jtable({
title: 'The Employee List',
paging: true, //Enable paging
pageSize: 10, //Set page size (default: 10)
sorting: true, //Enable sorting
defaultSorting: 'Name ASC', //Set default sorting
actions: {
listAction: '/Employee/Employees',
deleteAction: '/Employee/Delete',
updateAction: '/Employee/Edit',
createAction: '/Employee/Create'
},
fields: {
Id: {
key: true,
create: false,
edit: false,
list: false
},
Name: {
title: 'Name',
width: '15%'
},
Age: {
title: 'Age',
width: '5%'
},
Position: {
title: 'Post',
options: 'Employee/GetJobPosts',
width: '12%'
},
DownloadUrls: {
title: 'Resume',
width: '13%',
display: function (data) {
if (data.record.DownloadUrls) {
var urls = data.record.DownloadUrls.split(',');
var html = '';
var li = '';
urls.forEach(function (entry) {
li = li + '<li><a href="' + entry + '" target="_blank" runat="server" download>' + entry.split('/').pop() + '</a></li>';
})
html = "<ul>" + li + "</ul>";
return html;
} else {
return 'Please edit and upload resume';
}
},
input: function (data) {
return '<input type="file" name="resume" id="resume" multiple/>'
}
}
},
formCreated: function (event, data) {
console.log('adding multipart attribute')
data.form.attr('enctype', 'multipart/form-data');
}
});
//Load student list from server
$('#StudentTableContainer').jtable('load');
});
Where paging: true,
enables paging for the jTable and sorting: true,
enables sorting for jTable. But as you can see the script above I have a file upload in 1 field. It shows download urls for the files uploaded in the record.
So I do not want sorting to be enabled on only 1 field DownloadUrls. Other fields need to have sorting
I have seen Disable Column Header sorting on a JTable , but I am using .NET and jQuery not Java and Swing, so everything is managed in script only.