【发布时间】:2021-06-11 08:28:12
【问题描述】:
My aim is to only show bank related field if selected category is bank.
$('#EditDataTableDaybooks').jtable({ 标题:'账户日记', paging: true, //启用分页 pageSize: 25, //设置页面大小(默认:10) sort: true, //启用排序 defaultSorting: 'DaybookCode DSC',
actions: {
listAction: '/adminaccounts/get_daybook_list',
updateAction: '/adminaccounts/update_daybook_entry',
},
fields: {
Daybook_key: {
title: 'Daybook_key',
key : true ,
width: '3%',
edit: false,
visibility: 'hidden'
},
DaybookCode: {
title: 'Sr.No.',
create: true,
edit: false,
width: '5%',
key: true,
sorting: true,
},
DaybookGroup: {
title: 'Daybook Group',
width: '5%',
},
GroupName: {
title: 'Group Name',
width: '5%',
},
DaybookName: {
title: 'Daybook Name',
width: '10%',
},
ShortForm: {
edit: false,
title: 'Short Form',
width: '8%',
},
DaybookType: {
// edit: false,
title: 'Type',
width: '8%',
type: 'radiobutton',
visibility : 'show',
options: {'CA':'Cash',
'BN':'Bank',
'JV':'Journal Voucher',
'BJ':'Bill Journal',
'AB':'Adjustment Bill',
'DN':'Debit Note',
'CN':'Credit Note'},
},
这些字段在初始化时保持隐藏 帐户名称: { 类型:'隐藏', 标题:'帐户名称', 宽度:'10%', }, 帐号: { 类型:'隐藏', 标题:'帐号', 宽度:'10%', }, ifsc_code: { 类型:'隐藏', 标题:'Ifsc代码', 宽度:'10%', },
},
recordUpdated: function(event,data) {
console.log(data.serverResponse.error_message)
error_message = data.serverResponse.error_message
if (error_message != ''){
alert("Zoho Book Error: " + error_message)
}
console.log(event)
$.ajax({type:'POST',
url: '/adminaccounts/get_daybook_list',
success: function(responseText){
console.log(responseText)
$('#EditDataTableDaybooks').jtable('load');
},
});
},
formCreated: function(event, data) {
console.log(event);
console.log(data);
console.log(data.record.DaybookType);
if (data.record.DaybookType == 'BN'){
console.log('logic to enable hidden fields');
}
块引用
}
});
【问题讨论】:
标签: javascript jquery forms jquery-jtable