Hi Abu,
Currently formatting works great for url with www. or nothing in front of the url.
So nba.com & http://www.nba.com works great. Issue is for those url that can only work with http:// in front of them so I have to save them this way in the database.
The below formatting for the column leaves out the : when http:// is in the url. eg http//nba.com
Is there a way to keep the colon?
$acol_val["formatter"] = "function(cellval,options,rowdata){ return '<a target="_blank" href="http://'+cellval+'">'+cellval+'</a>'; }";
$acol_val["unformat"] = "function(cellval,options,cell){ return $('a', cell).attr('href').replace('http://',''); }";
Regards,
Glenn
Try following:
$acol_val["formatter"] = "function(cellval,options,rowdata){ return '<a target="_blank" href="'+ ((cellval.indexOf('http') == -1) ? 'http://': '') +cellval+'">'+cellval+'</a>'; }";
$acol_val["unformat"] = "function(cellval,options,cell){ return $('a', cell).attr('href').replace('http://',''); }";