Passing another column id in jQgrid showLink formatting

I had a bean object with me in colmodel jqgrid. an object has two attributes name and id. I used the showLink formulator to form a hyperlink in one of the columns. Now I have the name colum with object.name, and on click I want to send the identifier to the URL. Any material on how to work on this. Any inputs can help me

the code:

colModel :[ {name:'xxx', label:'xxx', width:200,align:'left'}, {name:'yyy', label:'yyy', width:110,align:'left'}, { name:'zzz', label:'zzz', width:100, sorttype:'int', formatter:'currency', formatoptions:{decimalSeparator:".", thousandsSeparator: ",", decimalPlaces: 0, prefix: "$ "}, align:'center' }, {name:'aaa', label:'aaa', width:80,align:'left'}, {name:'bbb', label:'bbb', width:100,align:'left'}, { name:'strategies.name', label:'strategies', width:160, align:'left', formatter:'showlink', formatoptions:{baseLinkUrl:'MyLink.html',addParam: '',showAction:'',idName:'id'} }] jQuery("#gridtableid").jqGrid('filterToolbar',{defaultSearch : "cn",stringResult: true,searchOnEnter : false}); 

Thanks in advance....

+1
jqgrid
source share
1 answer

In JQgrid, you can call the javascript function and perform any formatting. You have all the string data to play with it.

What you need to do is call the showlink function in your case and remove the formatting from this line. HSelect a separate showlink js function, as shown below, and return the prepared link back to the grid.

 function showLink(cellvalue, options, rowObject) { var link = "<a href ='<a href=\"http://www.w3schools.com&id='"+rowObject.columnid+"\">'+ rowObject.columnName + "</a>"; } 
+3
source share

All Articles