How do I set the display text on a link column in jqGrid. I want the text in every column to just say "View" with the link containing the specific Id. Here is what I currently have, but the Id get displayed in the column instead of the text "View". I was hoping to do it without passing the link html in the json returned data.
{ name: 'myId', index: 'View', edittype: 'select', formatter: 'showlink', formatoptions: { baseLinkUrl: 'Consumer/Details', idName: 'myId'} }
My json object getting return looks like this:
select new
{
myId = obj.myId.ToString(),
Date = String.Format("{0:d}", obj.Date),
Description = obj.Description,
View = "View"
}
If I correct understand your question you can just use the following simple custom formatter instead of 'showlink' predefined formatter:
If you need to include some additional information in the URL of
href
you can use properties of therowObject
(rowObject.Date
,rowObject.Description
) or replaceopts.rowId
to thecellvalue
orrowObject.myId
.You should additionally verify whether the property
edittype: 'select'
which you use is correct for the column. It looks like Cut&Paste error, especially because you don't useeditable: true
property.