This is my first time setting up a jqGrid, so I implemented a basic grid but am having a rather difficult time passing the __RequestVerificationToken to my controller.
$("#RawMatGrid").jqGrid({
url: "/RawMat/GetRawMats",
datatype: 'JSON',
mtype: 'GET',
colNames: [
'Item',
'Product',
'Description'
],
colModel: [
{ name: 'Item', key: true, index: 'Item', sortable: true, editable: true },
{ name: 'Product', key: true, index: 'Product', sortable: true, editable: true },
{ name: 'Description', key: true, index: 'Description', sortable: true, editable: true }
],
pager: "#paging",
rowNum: 10,
rowList: [10, 20, 30, 40, 50],
width: 780,
height: 500,
viewrecords: true,
caption: 'Raw Mats',
emptyrecords: 'No records to display',
autowidth: true,
multiselect: false,
jsonReader: {
root: "rows",
page: "page",
total: "total",
records: "records",
repeateditems: false,
Id: "0"
}
}).navGrid(
"#paging", {
edit: true,
add: true,
del: false,
search: true,
refresh: true
},
{ },
{ //Add
zIndex: 100,
url: '/RawMat/Create',
mtype: 'POST',
// This did not work
editData: { __RequestVerificationToken: jQuery('input[name=__RequestVerificationToken]').val() },
processData: "Processing...",
width: 400,
closeOnEscape: true,
closeAfterEdit: true
},
{});
After trying to use the editData field and failing horribly, I have come to ask the experts.
I saw an example of someone being able to pass the token via extraparams within their inline, but the navGrid Add does not allow extraparams from what I read on the documentation site. Has anyone had any experience passing it through the main grid's CRUD controls? Any and all help is definitely appreciated!