Am I just missing something simple here? Without going into custom formatting, I'd just like to use my ID values for the ID parameter in the showlink
formatter. Here is an example of my sub-grid:
subGridRowExpanded: function (subgrid_id, row_id) {
var subgrid_table_id = subgrid_id + '_t';
$('#' + subgrid_id).html('<table id="' + subgrid_table_id + '" class="scroll" />');
$('#' + subgrid_table_id).jqGrid({
datatype: 'local',
colNames: ['Order Number', 'Request Type', 'Owner', 'Order Status', 'Status Date'],
colModel: [{
name: 'orderid',
index: 'orderid',
width: 150,
key: true,
formatter: 'showlink',
formatoptions: { baseLinkUrl: 'AOFOrderFacilities.aspx', idName: 'orderid' }
}, {
name: 'type',
index: 'type',
width: 100
}, {
name: 'owner',
index: 'owner',
width: 200
}, {
name: 'status',
index: 'status',
width: 150
}, {
name: 'date',
index: 'date',
width: 150
}],
sortname: 'num',
sortorder: 'asc',
height: 'auto'
});
// TODO: Make this into an AJAX call. This is just for demo.
var mysubdata = [
{ orderid: 'O00001234', type: 'Data', owner: 'Melanie Martin', status: 'Saved', date: '2/4/2011 11:48:18 AM' },
{ orderid: 'O00001235', type: 'Voice', owner: 'Billy Solomon', status: 'Submitted to TC', date: '2/4/2011 12:03:47 PM' }
];
for (var i = 0; i <= mysubdata.length; i++)
jQuery('#' + subgrid_table_id).jqGrid('addRowData', i + 1, mysubdata[i]);
}
When the links in the first column of the grid are rendered, they correctly display the orderid
value as the text of the column (the pre-pended "O" is intentional, and should be passed through the system like that), but the resulting links are:
http://localhost/somestuff/AOFOrderFacilities.aspx?orderid=1
http://localhost/somestuff/AOFOrderFacilities.aspx?orderid=2
And so on, where the ID parameter value is the ordinal index of the grid row rather than the desired value from the data. Is there an easy way to use the value from the data instead?