您不需要破解 jTable 库资产,当您想要更新到更高版本时,这只会导致痛苦。您需要做的就是通过 jTable 字段选项“输入”创建自定义输入,请参阅示例字段设置以在此处完成您需要的内容:
JobId: {
title: 'JobId',
create: true,
edit: true,
list: true,
input: function (data) {
if (data.value) {
return '<input type="text" readonly class="jtable-input-readonly" name="JobId" value="' + data.value + '"/>';
} else {
//nothing to worry about here for your situation, data.value is undefined so the else is for the create/add new record user interaction, create is false for your usage so this else is not needed but shown just so you know when it would be entered
}
},
width: '5%',
visibility: 'hidden'
},
和简单的样式类:
.jtable-input-readonly{
background-color:lightgray;
}