views:

815

answers:

2

I am trying to create a link to an url such as home/details/1 in a jqGrid column.

The documentation shows : showlink {baseLinkUrl: '', showAction: 'show', addParam:'&key=2'} Note: the addParam should contain &.

For example: formatter: ’showlink’, formatoptions: {baseLinkUrl: ’someurl.php’, addParam: ‘&action=edit’} This will output: http: // localhost / someurl.php?id=123&action=edit

Has anyone used the formatter to create routes instead of querystrings?

A: 

I've not used jqGrid but as far as I can tell, you should not set anything for addParam, since that'll just append it as a QueryString. Try setting your route to the baseLinkUrl.

çağdaş
{ name: 'ID', index: 'ID', width: 80, align: 'left', formatter: 'showlink', formatoptions: {baseLinkUrl: '/home/details/' }},Results in: /home/details/show?id=2undefinedThe problem is how to append the ID baseLinkUrl. And get rid of undefined
Danny
Ah, I see. The formatter must be automatically appending the ID to the QueryString. I guess you'll have to write your own formatter function. I've seen some examples of it on the documentation of jqGrid.
çağdaş
Creating the formatter function sorted it
Danny
Glad you worked it out :)
çağdaş
A: 

Can you possibly post your solution to this answer? I'm interested as I'm working on something similar, I need to output the url such as: /view/article-name-here

instead of having the id I would like to use a hidden attribute.

uniacid