在jqgrid showLink格式化程序中传递不同的列ID [英] Passing different column id in jqgrid showLink formatter
问题描述
我在jqgrid的协同模型中有一个bean对象.该对象包含两个属性名称和ID.我使用showLink格式化程序在其中一列中形成了超链接.现在,我用object.name命名该列,然后单击以在URL中发送ID.关于如何进行此工作的任何输入. 任何输入都可以帮助我
I had a bean object with me in the colmodel of jqgrid. the object hold two attributes name and id. I used a showLink formatter to form the hyperlink in one of the column. Now i have names the colum with object.name and on click i want to send the id in URL. Any inputs on how to work on this. Any inputs could help me
代码:
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});
提前谢谢....
推荐答案
在JQgrid中,您可以调用javascript函数并进行所需的格式设置.您将拥有完整的行数据.
In JQgrid, you can call a javascript function and do any required formatting . You have the entire row data to play with it.
您需要做的是在您的情况下调用showlink函数,并从该行中删除formatoptions.拥有一个单独的js函数showlink,如下所示,并将准备好的链接返回到网格.
What needs to be done is call a function showlink in your case and remove formatoptions from that row. HAve a separate js function showlink as 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>";
}
这篇关于在jqgrid showLink格式化程序中传递不同的列ID的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!