I have a class (Person) with 4 properties : Id, FirstName, LastName, Code.
I show a person list in a jqgrid. I’d like a link column with this format (the code has this format 2011.0001)
/Person/Detail/Code => /Person/Code/2011.0001
But I have this with the code below :
/Customer/Detail?Code=2
I tried this :
colModel: [
{ name: 'Code', index: 'Code', formatter: 'showlink', formatoptions: { baseLinkUrl: '/Customer/Detail', idName: 'Code' }},
{ name: 'LastName', index: 'LastName', align: 'left' },
{ name: 'FirstName', index: 'FirstName', align: 'left' }
],
How can I correct this ?
Thanks,
Update1, Data format
[
{"Id":1,"FirstName":"AAAA","LastName":"AA","Code":"2011.0001"},
{"Id":3,"FirstName":"BBBB","LastName":"BB","Code":"2011.0003"}
]
You can try to use the custom formatter in the form
instead of predefined formatter ‘showlink’:
You can easy receive
/Customer/Detail?Code=2011.0001if you have unique data in the ‘Code’ column and if you would addkey: trueto the column definition. In the case theIdvalue from the JSON input will be ignored and the value from the ‘Code’ column will be used as the rowid. If you do need to have thehrefvalue in the form/Customer/Detail/Code/2011.0001or instead of/Customer/Detail?Code=2011.0001you will need use custom formatter as I described before.