tags:

views:

36

answers:

1

In the jqgrid, when i click the first column value, i want to open as iFRAME window. if i use showlink or link formatter, its posted and redirect to the another page. how to create first column value as iframe window.

Thanks in avance..

A: 

One method is to use a link to the same page in your format options:

formatoptions: {baseLinkUrl: '#', showAction: '', addParam: ''}

Then after the grid is rendered - for example, in the loadComplete event - set up a click event handler for when a link is clicked:

    jQuery('.ui-jqgrid-btable a', '#container').each(function()
    {
       jQuery(this).unbind('click');
       jQuery(this).click(function(){
          var link = jQuery(this).attr('href');
          var equalPosition = link.indexOf('='); // Get the position of '='
          var id = link.substring(equalPosition + 1); // Split the string and get the number.

          // Your iframe code here...

          return true;
       });

This code simply parses out the link, gets the ID, and then lets to do whatever you want with that ID . So for example, you could load content into a new iFrame.

#container is optional, but you could use this as a div that contains the jqGrid div, if you have multiple grids on the same page and need to differentiate them.

Justin Ethier