Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6529843
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T09:41:04+00:00 2026-05-25T09:41:04+00:00

Hi I am trying to get showlink formatter working by following this document from

  • 0

Hi I am trying to get showlink formatter working by following this document from trirand.

What I want to achieve is a hyperlink I can click for a edit view to update/edit records. But for some reason, the column are empty where I want show a hyperlink.

Here is my code snippets, and link is the last column:

<script type="text/javascript">
    $(document).ready(function () {
        $("#grid_products").jqGrid({
            jsonReader: {
                repeatitems: false,
                id: 'Guid'
            },
            url: '/Product/jqgridJSON/',
            datatype: 'json',
            mtype: 'GET',
            colNames: ['ProductCode', 'ProductDescription', 'DefaultSellPrice', 'LastCost', 'Edit'],
            colModel: [
                { name: 'ProductCode', index: 'Productcode' },
                { name: 'ProductDescription', index: 'ProductDescription' },
                { name: 'DefaultSellPrice', formatter: 'currency', index: 'DefaultSellPrice' },
                { name: 'LastCost', formatter: 'currency', index: 'LastCost' },
                { name: 'MyLink',
                    edittype: 'select',
                    formatter: 'showlink',
                    formatoptions: { baseLinkUrl: '/Product/Update/', idName: 'Guid' }
                },
                ],
            pager: '#pager',
            rowNum: 10,
            rowList: [20, 50, 100, 200],
            sortname: 'ProductCode',
            sortorder: 'asc',
            viewrecords: true,
            width: 'auto',
            height: 'auto',
            caption: 'Products'
        }).navGrid('#pager', { edit: true, add: false, del: false });
    });
</script>

@{
    ViewBag.Title = "JSONGrid";
}

<h2>JSONGrid</h2>
<table id="grid_products"></table>
<div id="pager"></div>

The formatter from jqGrid is working for currency, but for some reason, it just didn’t shown for hyperlink.

Update:

Got it working by using custom formatter.

...
{ name: 'MyLink',
                    formatter: myLinkFormatter,
                },
...

function myLinkFormatter (cellvalue, options, rowObjcet) {
    return '<a href = "/Product/Edit/' + options.rowId + '">Edit this product</a>';
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T09:41:04+00:00Added an answer on May 25, 2026 at 9:41 am

    I suppose that you fill no value in JSON input for the 'MyLink' column. Because of this the hyperlink is empty. If you want to place the link with any fixed text in column I would recommend you to use custom formatter. See the recent answer for an example.

    One more possible solution way is to use formatter: 'showlink' and include jsonmap: function() { return "Edit"; } to the ‘MyLink’ column definition. In the case you will not need to include in the JSON data "MyLink":"Edit" for every row of data. It’s important to understand that the trick works only in case of usage jsonReader: {repeatitems: false} (so it should work for your grid).

    If you have another problem you should include in the text of your question the JSON data which you use.

    Some small remarks to your current code:

    • the usage of edittype: 'select' together with formatter: 'showlink' has no sense. You should remove it if you will do use formatter: 'showlink'.
    • the parameter height: 'atuo' should be height: 'auto'.
    • pager: $('#pager') is better to replace to pager: '#pager'. If you use pager: $('#pager'), the jqGrid will replace it internally to pager: '#pager' and the object $('#pager') will be discarded.
    • If you use jsonReader: { id: 'Guid'} and you don’t plan to show the guids to the user you can remove the 'Guid' column from the grid. The id (the Guid in your case) will be used to assign ids of <tr> elements (table rows) of the grid. So you don’t need to hold the same information twice
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Trying to get this expression to work, can someone look at it and tell
I am trying get my head around how you can run the following php:
I'm trying get some licensing code from AndroidPit.com working, but I get Unable to
I am trying get this background to fade in on click. I found one
I am trying get currently focused component id. For this I used following jQuery:
Trying to use modules in Yii and want to get access from main controller
I am trying get this ListView working and i'm trying to sort the list
I'm trying get values from a GridView using the following code: foreach (GridViewRow row
I'm trying get the visible portion of UIImage from an UIImageView . UIImageView takes
I am trying get the html within .event_recur. $(.entry).each(function(){ alert($(this).find(.event_recur).html()); }); <div class=entry> <p

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.