Wednesday, September 10, 2014

Formatting or customizing the jqgrid colmodel view

JqGrid colModel setup:
Here we need to add new property to customize the data for example building a hyper link instead of showing the data, we need to add property called formatter below is the sample code 
colModel : [{name : 'whois',
index : 'whois',
width : 25,
align : 'center',
sortable : false,
editable : false,
classes : "actions-col",
formatter : buildWhoisLink
},
......
]




Here is the function for buildWhoisLink

function buildWhoisLink(cellvalue, options, rowObject) {
return "<a id=\"whois_"+options.rowId+"\" onclick=\"return showWhois('"+rowObject[0]+"', "+options.rowId+");\" href=\"#\">Whois</a>";
}

No comments: