I have implemented jqgrid with some columns out of which one is hidden. I want that column should be available in add and edit mode in inline form.In my code I have created custom add and edit buttons. So all this happen on click of these custom add and edit button. My code is as below. I want to show Renewd Cheque number only in add/edit mode.
function createTransactionGrid()
{
transactionGrid = jq("#transactionList").jqGrid(
{
url : urlTransactionList,
datatype : 'json',
mtype : 'POST',
postData : tranPostData,
colNames : ['voucher Id', 'transaction Num', 'Cheque Number','Renewed Cheque Number'],
colModel : [
{
name : 'chequeVoucherId',
index : 'chequeVoucherId',
sortable : false,
hidden : true
},
{
name : 'transactionNum',
index : 'transactionNum',
sortable : false,
key : true,
hidden : true
},
{
name : 'chequeNumber',
index : 'chequeNumber',
align : 'right',
sortable : false,
width : 120,
editable : true
},
{
name : 'renewChequeNumber',
index : 'renewChequeNumber',
align : 'right',
hidden : true,
sortable : false,
width : 120,
editable : true,
editrules : {edithidden:true}
}
],
pager : '#pager_t',
sortorder : 'desc',
viewrecords : true,
gridview : true,
rowList : [5, 15, 25, 50],
rownumbers : true,
forceFit : false,
caption : 'Transactions Details',
width : 1060,
height : 'auto',
loadComplete : function(data){
lastSel = null;
grid_add();
}
}).jqGrid('navGrid', '#pager_t',
{
edit : false,
view : false,
add : false,
del : false,
search : false,
refresh : true,
cloneToTop : true
});
return transactionGrid;
}
function grid_add(){
var totalRecords = transactionGrid.jqGrid('getGridParam', 'records');
jq("#pager_t_add").removeClass('ui-state-disabled');
transactionGrid.navButtonAdd('#'+transactionGrid[0].id+'_toppager_left',
{
id : "pager_t_add",
caption : "Add",
buttonicon : "ui-icon-plus",
title : "Add Transactions",
onClickButton : function()
{
jq.ajax(
{
url : urlAddTransaction,
type : 'Post',
dataType : 'json',
data : tranPostData,
success : createTransactionRow
});
},
position:"last"
});
}
function createTransactionRow(transaction)
{
lastSel = transaction.nextTransactionNo;
var datarow =
{
chequeVoucherId : transaction.voucherId,
transactionNum : transaction.nextTransactionNo
};
var su = transactionGrid.addRowData(transaction.nextTransactionNo, datarow, "last");
if(su != null)
{
jq("#pager_t_transaction").attr("title","Save");
jq("#transaction_caption").html("Save");
transactionGrid.editRow(transaction.nextTransactionNo, false);
transactionActionFlag = 'A';
}
}
return false;
}