Note that there are some explanatory texts on larger screens.

plurals
  1. POAdding links to jQgrid and open in new window
    text
    copied!<p>I have this jqgrid definition and I'm trying to open the selected document in a new Window.</p> <p>My final urls should like these:</p> <pre><code>http://localhost/XPagesSortableSearchResults.nsf/xPerson.xsp?documentId=9D93E80306A7AA88802572580072717A&amp;action=openDocument </code></pre> <p>and also I need to generate this type of url:</p> <pre><code>http://localhost/XPagesSortableSearchResults.nsf/$$OpenDominoDocument.xsp?documentId=9D93E80306A7AA88802572580072717&amp;action=openDocument $().ready(function(){ jQuery("#list2").jqGrid({ url:'./xGrid7.xsp/peoplejson', datatype: "json", colNames:['InternetAddress','#','Name','OfficeCountry'], colModel:[ {name:'InternetAddress',index:'InternetAddress', width:200}, {name:'@position',index:'@position', width:50,sorttype:'int'}, {name:'$17',index:'$17', width:200}, {name:'OfficeCountry', width:200, formatter:editLinkFmatter // formatter:'showlink', // formatoptions:{ baseLinkUrl:'xPerson.xsp',addParam: '&amp;action=openDocument', idName:'documentId'} } ], jsonReader: { repeatitems: false, id: '@unid', root: function (obj) { if ($.isArray(obj)) { return obj; } if ($.isArray(obj.items)) { return obj.items; } return []; }, page: function () { return 1; }, total: function () { return 1; }, records: function (obj) { if ($.isArray(obj)) { return obj.length; } if ($.isArray(obj.items)) { return obj.items.length; } return 0; } }, caption: "JSON Example", height: 500, gridview: true, loadonce: true, ignoreCase: true, rowNum: 50, rowList: [50, 100, 500, 1000], pager: '#pager2' }).jqGrid('filterToolbar', {stringResult: true, defaultSearch: 'cn', searchOnEnter: false}); </code></pre> <p>Note my Json object looks like this and I'm not using the documentId I need on my url as part of my ColModel; the value I need is @unid</p> <pre><code> [ { "@entryid":"1-B933790B1DC265ED8025725800728CC5", "@unid":"B933790B1DC265ED8025725800728CC5", "@noteid":"1E76E", "@position":"1", "@read":true, "@siblings":40000, "@form":"Person", "$17":"Aaron, Adam", "InternetAddress":"consurgo@compleo.net", "OfficeCountry":"Namibia" }, { "@entryid":"2-9D93E80306A7AA88802572580072717A", "@unid":"9D93E80306A7AA88802572580072717A", "@noteid":"19376", "@position":"2", "@read":true, "@siblings":40000, "@form":"Person", "$17":"Aaron, Dave", "InternetAddress":"gratia@incito.co.uk", "OfficeCountry":"Brazil" }, { "@entryid":"3-FAFA753960DB587A80257258007287CF", "@unid":"FAFA753960DB587A80257258007287CF", "@noteid":"1D842", "@position":"3", "@read":true, "@siblings":40000, "@form":"Person", "$17":"Aaron, Donnie", "InternetAddress":"vociferor@nequities.net", "OfficeCountry":"Algeria" } ] </code></pre> <p>So far I make it work using:</p> <pre><code> {name:'OfficeCountry', width:200, formatter:'showlink', formatoptions:{ baseLinkUrl:'xPerson.xsp',addParam: '&amp;action=openDocument', idName:'documentId'} } </code></pre> <p>but I need to open it in a new window</p> <p>I also tried with formatter:editLinkFmatter</p> <pre><code>function editLinkFmatter(cellvalue, options, rowObject) { return "&lt;a href='./" + rowObject[2] + "' class='requestlink'&gt;" + cellvalue + "&lt;/a&gt;"; //return "&lt;a href='./documentId=" + rowObject.@unid + "' &gt;Click here&lt;/a&gt;"; //return "&lt;a href='./documentId=" + options.idName + "&amp;action=OpenDocument'&gt;" + cellvalue + "&lt;/a&gt;"; } </code></pre> <p>and I can't use rowObject.@unid because the node name</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload