jQuery("#CustomerDetailsGrid").jqGrid({
//ignore other properties
colModel: [
{ name: 'AccountNumber', index: 'AccountNumber', hidden: true, viewable: true }
],
viewrecords: true
});
I need to hide the column "Account Number" in grid view but show it in the form view.(Not edit form)
To follow-up J_'s suggestion, applying the following does the trick:
Scenario #1:
Solution:
The providerUserId is visible in the grid and visible when editing the form. But you cannot edit the contents.
Scenario #2:
Solution:
Notice in both instances I'm using jq to reference jquery, instead of the usual $. In my HTML I have the following script to modify the variable used by jQuery:
The best way is only adding the editrules:{edithidden:true} option.
If the View dialog will be created it will be filled with the information about every column placed in the rows. The id of the row (the id of
<tr>
element) will be constructed from the prefix "trv_" and the name of the corresponding column. It it important to understand, that in the form it will be filled the information about all columns inclusive hidden columns, but<tr>
elements for the hidden columns will be hidden (has style="display: none;"). So to make the information visible it is enough to calljQuery.show()
function for the corresponding<tr>
element.I prepared the small demo which demonstrate this. In the demo
id
column are hidden, but I make the information visible inside ofbeforeShowForm
andafterclickPgButtons
event handler of the View options:To hide the grid column