java - jqgrid readonly combobox -


i developing web application using jsp & servlet (ide: eclipse, database: oracle10). using jqgrid display records in tabular format.

i want set combobox readonly in edit dialog.

colnames & colmodel

colnames:['user name', 'seq no.'], colmodel:[             {name:'user_id',index:'user_id', width:200,sortable:true,editable:true,edittype:"select", editoptions: {maxlength: 20,dataurl: 'servletname?action=combouserid'}},             {name:'sequence_number',index:'sequence_number', width:50,sortable:true, editable:true, editrules: { required: true, number:true},editoptions: {size:4,maxlength: 2}}          ], 

pager code

).navgrid('#pager10_d1',{clonetotop:true,edit:true,add:true,del:true,view:true,search: true},                 {                     width:350,                     modal:true,                     jqmodal: false,                     savekey: [true,13],                     closeonescape:true,                     mtype:'post',                     closeonsubmit: true,                     recreateform: true,                     editurl:'myservletname',                     editdata:                     {                         action: 'userrolesupdate',                         userid: function () {return userid;}                     },                     beforeshowform: function(form)                     {                         $('#user_id',form).attr('readonly','readonly');                     }                  }                 //add dialog , other dialog code here                 ); 

i refering answer oleg , on form not working, combobox still editable. same code works other field in grid, not working combobox. let me know if there mistake in code.

i think <select> (combobox) can't readonly. can disable instead using

$("#user_id", form).prop("disabled", true); 

or

$("#user_id", form).attr("disabled", "disabled"); 

if use old version of jquery (before 1.6).


Comments

Popular posts from this blog

monitor web browser programmatically in Android? -

Shrink a YouTube video to responsive width -

wpf - PdfWriter.GetInstance throws System.NullReferenceException -