【发布时间】:2019-06-27 13:47:24
【问题描述】:
我的目标是在此表单上创建一个复选框,但仅根据下拉列表的值显示它。
{
//this is the drop down list value
key: false, label: 'T.Expediente', name: 'COD_DPTO_ORIGEN', editable: true,
edittype: 'select', /*editoptions: { value: $scope.settings.cbGridCodTipExpOp },*/ formatter: 'select', width: 5,
editrules: { required: false }, editoptions: { 'class': 'bg-required' },
},
{
//and this is the checkbox I had to create
key: false, label: 'Colaborativo', name: 'FLAG_COLABORATIVO', hidden: true, editable: true, edittype: 'checkbox',
formoptions: { label: '¿Colaborativo?' },
editrules: { edithidden: true },
editoptions: { value: "1:0", defaultValue: "0" },
},
只有当下拉列表的值为“13”时才会显示复选框。
当用户决定向某个表添加新寄存器时,会出现此表单。
对不起,我改变了一些东西,因为我不能展示它,但它们与我的问题没有任何关系
showNavGrid: true, // Muestra o no Navgrid.
navTools: { add: true, edit: true, del: true, view: true, refresh: true, search: false },
prmAdd: {
closeOnEscape: true, closeAfterAdd: true, recreateForm: true,
id: 'ROWID',
url: AtUrlValue.XXXXXXXXX
editData: { __RequestVerificationToken: $rootScope.sAntiForToken },
beforeShowForm: function (form) {
$('#xxxxxx', form).show();
$('#xxxxxx', form).hide();
$('#xxxxxx', form).attr("disabled", false);
$('#tr_' + 'xxxx', form).hide();
//THIS is what i've tried
if ( $('#COD_DPTO_ORIGEN').val() == "13" ) {
$('#tr_FLAG_COLABORATIVO', form).show();
}
else {
$('#tr_FLAG_COLABORATIVO', form).hide();
}
},
它确实按照我的方式工作,但它只在页面加载时输入 if,因为它在事件 beforeShowForm 上。但是我不知道如何动态制作,谢谢!
【问题讨论】:
标签: javascript jquery jqgrid