Reputation: 816
Can I use cell value of some other column in the formatter key of colModel.
So basically, I want to change cellvalue --> cellvalue of some other column
.
colModel.push({
'formatter': function(cellvalue, options, rowObject) {
return '<a href="http://someLink/' + cellvalue + '">' + cellvalue + '</a>';
}
});
Upvotes: 0
Views: 3198
Reputation: 221997
Let us you have two columns name: "mycol1"
and name: "mycol2"
and you want to add custom formatter
in column 1, which used the property mycol1
of input data in the URL of the anchor and the the property mycol1
as the text of the anchor. The code could be the following:
colModel.push({
name: 'mycol1',
formatter: function(cellvalue, options) {
return '<a href="http://someLink/' + cellvalue + '">' +
options.rowData.mycol2 + '</a>';
}
});
Upvotes: 2