jTable 禁用对特定列的排序
jTable disable sort on specific column
我正在使用 jTable 插件在 MVC 应用程序中显示数据。我已经设置 table 如下。
$(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');
});
其中 paging: true,
为 jTable 启用分页,sorting: true,
为 jTable 启用排序。但是正如您在上面的脚本中看到的那样,我在 1 个字段中上传了一个文件。显示记录中上传文件的下载地址。
So I do not want sorting to be enabled on only 1 field DownloadUrls. Other fields need to have sorting
我看过 Disable Column Header sorting on a JTable ,但我使用的是 .NET 和 jQuery 而不是 Java 和 Swing,所以一切都只在脚本中进行管理。
我正在使用 jTable 插件在 MVC 应用程序中显示数据。我已经设置 table 如下。
$(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');
});
其中 paging: true,
为 jTable 启用分页,sorting: true,
为 jTable 启用排序。但是正如您在上面的脚本中看到的那样,我在 1 个字段中上传了一个文件。显示记录中上传文件的下载地址。
So I do not want sorting to be enabled on only 1 field DownloadUrls. Other fields need to have sorting
我看过 Disable Column Header sorting on a JTable ,但我使用的是 .NET 和 jQuery 而不是 Java 和 Swing,所以一切都只在脚本中进行管理。