Forum


02:01

17/12/2008

I use form edit. I want to disable a field ('Date of Lab Confirmed Diagnosis') based on the value of another field ('Report Type'). The field 'Report Type' data type is select. I use dataevents "change". But I don't know the syntax of disabling a field.
Please see my codes below. Any help is highly appreciated!
-Maggie
jQuery(document).ready(function(){
jQuery("#communicableDiseaseGrid").jqGrid({
url:'servlet/communicableDiseaseByDateGrid',
datatype: 'xml',
colNames:[
'Report Type',
'Date Time of Report to HD',
'Date of Lab Confirmed Diagnosis'
],
colModel :[
{name:'reportType',
index:'reportType',
editable:true,
edittype:'select',
editoptions:{
value:{'Active_Report':'Active_Report', 'Information_Request':'Information_Request'},
dataEvents :[
{ type: 'change',
fn: function(e) {
var thisval = $(e.target).val();
if (thisval=="Active_Report") {
alert ("it is Information_Request, diable Date of Lab Confirmed Diagnosis ");
//how to disable the field 'Date of Lab Confirmed Diagnosis'?
//?????
}
}//end func
} // end type
] // dataevents
}
},
{name:'dateTimeHD',
index:'dateTimeHD',
sortable:true,
sorttype: "date",
editable:true,
editrules:{required:true}
},
{name:'dateLab',
index:'dateLab',
sortable:false,
editable:true}],
viewrecords: true,
caption: 'Communicable Disease'
}).setGridHeight(150);
$("#communicableDiseaseButtonEdit").click(function(){
var gr = jQuery("#communicableDiseaseGrid").jqGrid('getGridParam','selrow');
if( gr != null ) {
jQuery("#communicableDiseaseGrid").editGridRow(
gr,
{ top: 0,
left: 0,
width: 500,
height:280,
modal:true,
drag: true,
editCaption: 'Edit Record',
bSubmit: "Submit",
bCancel: "Cancel",
url:'servlet/communicableDiseaseByDateGrid?userAction=update',
processData: "Processing...",
closeAfterEdit:true,
reloadAfterSubmit:true,
}
});
}
else alert("Please Select Row");
});
16:37

01/08/2011

Hi,
to hide and show column you can use a click event
to Hide a column you can use e.g. this
jQuery("#button").click( function() { jQuery("#list").jqGrid('navGrid','hideCol',"column"); });
to show a column you can use e.g. this
jQuery("#button").click( function() { jQuery("#list").jqGrid('navGrid','showCol',"column"); });
I hope it helps you.
Best Regards,
DJ
00:54

17/12/2008

I've got a solution:
{name:'reportType',
index:'reportType',
sortable:false,
editable:true,
edittype:'select',
editoptions:{
value:{'Active Report':'Active Report', 'Information Request':'Information Request'},
dataEvents :[
{ type: 'change',
fn: function(e) {
var thisval = $(e.target).val();
// alert ("value: " + thisval);
if (thisval=="Information Request") {
//disable the field dateLab
$('#dateLab').attr('disabled', 'true');
}
if (thisval=="Active Report") {
//enable the field dateLab
$('#dateLab').removeattr('disabled');
}
}//end func
} // end type
] // dataevents
}
},
Cheers,
Maggie
Most Users Ever Online: 715
Currently Online:
60 Guest(s)
Currently Browsing this Page:
1 Guest(s)
Top Posters:
OlegK: 1255
markw65: 179
kobruleht: 144
phicarre: 132
YamilBracho: 124
Renso: 118
Member Stats:
Guest Posters: 447
Members: 11373
Moderators: 2
Admins: 1
Forum Stats:
Groups: 1
Forums: 8
Topics: 10592
Posts: 31289
Newest Members:
, razia, Prankie, psky, praveen neelam, greg.valainis@pa-tech.comModerators: tony: 7721, Rumen[Trirand]: 81
Administrators: admin: 66