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

  • SEARCH
  • Home
  • 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 1060379
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T18:19:06+00:00 2026-05-16T18:19:06+00:00

I need to load some dynamic html when a user click on a link

  • 0

I need to load some dynamic html when a user click on a link in a jqGrid.

here is my definition

function loadUserAdministrationList() {
    jQuery("#userlist").jqGrid({
        url: '/Administration/GetData/',
        datatype: 'json',
        mtype: 'GET',
        colNames: ['Username', 'Prénom', 'Nom', 'Courriel'],
        colModel: [{ name: 'Username', index: 'Username', width: 300, align: 'left',
                     edittype: 'select', formatter: 'showlink',
                     formatoptions: { baseLinkUrl: '/Administration/ModifyUser'} },
              { name: 'Prénom', index: 'Firstname', width: 300, align: 'left' },
              { name: 'Nom', index: 'Lastname', width: 300, align: 'left' },
              { name: 'Courriel', index: 'Email', width: 300, align: 'left'}],
        pager: jQuery('#userlistpager'),
        rowNum: 20,
        rowList: [5, 10, 20, 50],
        sortname: 'Firstname',
        sortorder: "asc",
        height:600,
        viewrecords: true,
        imgpath: '/Public/css/theme/custom/images',
        caption: '',
        loadtext: 'Chargement des utilisateurs...'
    }).navGrid('#userlistpager',
                { search: true, edit: false, add: false, del: false },
                {}, // default settings for edit
                {}, // default settings for add
                {}, // default settings for delete
                { closeOnEscape: true, multipleSearch: true,
                  closeAfterSearch: true }, //search options
                {}
    );
};

as you can see i would like to load a modification form.
How can i tell jqGrid to do an ajax call on the click of showLink ?
Thanks

  • 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-16T18:19:07+00:00Added an answer on May 16, 2026 at 6:19 pm

    A possible solution could looks like following:

    1. In the ‘Username’ you remove unneeded edittype: 'select' and align: 'left' and consider to add title: false instead to remove displaying of the ToolTip on hover a cell with the mouse.
    2. Modify formatoptions which contain formatter: 'showlink' to following: formatoptions: { baseLinkUrl: 'javascript:', showAction: "MyBase.GetAndShowUserData(jQuery('#userlist'),'#myDiv','", addParam: "');" }. jqGrid will construct href attribute of <a> element like following: href="javascript:MyBase.GetAndShowUserData(jQuery('#userlist'),'#userDetails','?id=rowId');" where rowId will be the id of the corresponding grid row.
    3. Add a global function (defined on the top level of your JavaScript) for example with the name MyBase.GetAndShowUserData like following:

    (In the code below we use global MyBase only for namespacing)

    var MyBase = {};
    MyBase.GetAndShowUserData = function (grid,tagetDivSelector,param) {
        // param will be in the form '?id=rowId'. We need to get rowId
        var ar = param.split('=');
        if (grid.length > 0 && ar.length === 2 && ar[0] === '?id') {
            var rowid = ar[1];
            var username = grid.getCell(rowid, 'Username');
            var userDetails = jQuery(tagetDivSelector);
            userDetails.empty();
            jQuery.ajax({
                url: '/Administration/ModifyUser',
                data: { userId: rowid, userName: username },
                type: 'GET',
                // optional contentType (depend on your server environment):
                // contentType: 'application/json',
                dataType: 'json',
                success:function(data,st) {
                    var s = "BlaBla";
                    // TODO: construct HTML code based on data received from the server
                    userDetails.html(s);
                },
                error:function(xhr,st,err){
                    alert(st + ": " + data.responseText);
                }
            });
        }
    };
    

    I suppose here, that on your page there are a <div> or other element with id="userDetails" like

    <table id="userlist"></table>
    <div id="pager"></div>
    <div id="userDetails"></div>
    

    and the function MyBase.GetAndShowUserData will make an ajax call and fill the results inside the <div id="userDetails"></div>. The code inside of MyBase.GetAndShowUserData is a raw template only. I wanted only to show how you can access the data from the grid.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need to call some jQuery .load() function from flash. i Use this: import
I need to load some resource from my DLL (i need to load them
Two Delphi programs need to load foo.dll, which contains some code that injects a
I need some guidance around which approach to use to load binary files from
I need to Load RVM into a shell session as a function , so
I need to load a custom function from an extern file but without causing
I'm creating a website where I'm doing ajax requests to load some dynamic content
I've created some dynamic controls on page load and added an event handler to
I have the following setup: <div id=whatever> <!-- Here some dynamic divs will be
i have some jquery logic, below is the code $(document).ready(function() { $('<ul class=className><\/ul>').insertBefore('.divClassName'); $.each(jsArray,

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.