Hiding/Showing form field via dataEvents
I want to hide/show the form field base on selection from select form field, I used the following code but it didn't hide the #Job开发者_如何学编程_Name. How to acheive this?
{ name: 'Job_Number',
index: '`Job #`',
editable: true,
edittype: 'text',
editoptions: { size: 10, readonly: 'readonly'},
editrules: {required: true },
formoptions: { label: 'Job #' },
width: 10,
formatter: 'integer',
formatoptions: { thousandsSeparator: '' },
searchoptions: { sopt: ['eq','ne','lt','le','gt','ge', 'in', 'ni'] },
align: 'right',
sortable: true
},
{ name: 'Job_Name',
index: '`Job Name`',
editable: true,
edittype: 'select',
editoptions: { //size: 1,
value:{1:'One',2:'Two'},
// dataUrl: 'select',
dataEvents: [
{ type: 'change',
fn: function(formid) {
$("tr_#Job_Number").hide();
}
}
]
},
formoptions: { label: 'Job Name' },
searchoptions: { sopt: ['eq','ne','lt','le','gt','ge', 'cn', 'nc', 'bw', 'bn'] },
align: 'right',
width: 150,
align: 'left',
sortable: true
}
Thanks in advance,
lupind
Does the event fire at all? Use alert('') to check.
Why do you use tr_#Job_Number - with underscore? Shouldn't it be tr#Job_Number or even just #Job_Number, or better $(formid).find("#Job_Number")?
精彩评论