Is it possible have a html link in a column with jqGrid, I can\'t find any example in the documentation?
Yes, use a formatter, either a custom formatter or Predefined Formatter.
If you use xml data, you can add a dummy column in your query to display it in the grid
grid:
colModel :[{name:'EDIT',edittype:'select',formatter:'showlink', width:5,xmlmap:"Edit",formatoptions:{baseLinkUrl:'someurl.php', addParam: '&action=edit'}},
query:
select f1,f2,f3, 'Edit' as Edit FROM table
within the json data i am using for the grid, i just send html code back with a href tag in, that works for me
Here's the sample colModel configuration from Craig's link to jqGrid formatting help. It specifies the formatter as showLink and the url and params are specified with formatoptions.
colModel: [ {name:'myname',
edittype:'select',
formatter:'showlink',
formatoptions:{baseLinkUrl:'someurl.php', addParam: '&action=edit'}
Sorry to post to an old question, but here is another option that worked for me: simply create a custom formatter and return an anchor tag (a good option if you need really granular control of the link):
function returnMyLink(cellValue, options, rowdata, action)
{
return "<a href='/Controller/Action/" + options.rowId + "' >Click here</a>";
}
Look in the rowdata for the data returned by your query. Hope this helps someone!
in xml I use entity < instead of < in the a tag like this <a href="dest">my link</a> and works fine with jqgrid 3.6