'I need to render text on a data table
I am working with Data Tables and I have a function that I can't seem to figure out. I am using SSP and I have my columns set up in an array. See below:
$columns = array(
array( 'db' => 'businessName', 'dt' => 0 ),
array( 'db' => 'website', 'dt' => 1 ),
array( 'db' => 'phone', 'dt' => 2 ),
array( 'db' => 'streetAddress','dt' => 3 ),
array( 'db' => 'city','dt' => 4 ),
array( 'db' => 'state','dt' => 5 ),
array( 'db' => 'zip','dt' => 6 )
);
The column website has businesses that don't always have a site. I would like to render a "No site available" for null data and add a "Visit Website" with a link using the pulled data for sites that do have a website.
I can easily do this in php ie:
if ($row['website'] == "") {
$website = "No Website";
}else {
$website = "<a href='".$row['website']."' rel='_blank'>Visit Website</a>";
}
Please point me in the right direction. Thanks in advance!
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
