Warning The ID for {{Name}} is #{{ID}}.
'
);
$dt->cell = array(
"Company" => array(
//you can even pass a closure for the URL property
"url" => function($row, $value) {
if ($value == "Pharetra Nam Industries")
return "http://facebook.com";
else
return "http://maps.google.com/maps?z=12&t=m&q=".$row->City."+".$row->Zip;
},
"icon" => "fa-external-link txt-color-red",
"callback" => function($row, $html_value) { // if you want to get the configured HTML cell, use this key
$some_number = rand(1, 15);
$color = $some_number > 10 ? 'red' : 'greenLight';
return $html_value.' '.$some_number.'';
}
),
//pass closure function and return a dynamic content
"Name" => function($row, $value) {
switch ($value) {
case "Tanek":
return ''.$value.'';
break;
case "Alana":
return $value.' 5';
break;
case "Donna":
return $value.' active';
break;
default:
return $value;
}
},
"Phone" => '{{Phone}} active'
);
//$dt->options('static', true);
// set a cell using jQuery setup
$dt->cell("Zip", function($row, $value) {
return ' '.$value;
}, function($dt) { // callback
//$dt->cell("Zip", "");
});
// change the column name
$dt->col("ID", "ID #");
// set hidden columns
$dt->hidden(array("ID", "Date")); // or $dt->col("ID", false)->col("Date", false) -- same as renaming but with "false" as value
// hide a column
//$dt->hide("City", true);
// configure rows
// available properties for row
// class, attr, hidden, detail, checkbox
$dt->row(2, ""); // empty a row
$dt->row(3, "danger"); // set class property or $dt->row(5, array("class" => 'txt-color-red'))
// reset all row settings
//$dt->row(null);
// get number of rows
$rows = $dt->rows();
for ($i = 4;$i <= 20; $i++) {
$dt->row($i, function($row) {
if (strpos($row->Name, 'e') !== false) {
return array("detail" => false, "checkbox" => false, "class" => "success");
} else if (strpos($row->Name, 'n') !== false) {
return array("detail" => false, "content" => '');
}
});
}
// set table's id
$dt->id = "test-table-id";
$dt->sort('Name', 'desc');
//configure the widget of this table by getting the widget property
//learn more about SmartUI:Widget class at widgets-php.php
$widget = $dt->widget;
$widget->header("icon", 'fa fa-exclamation')->options("editbutton", false);
//->body("class", ''); // you want padding? remove the widget's class
$widget->id = "widget-id";
$cities_htm = '';
$arr_cities = array("Fogo", "Machelen", "Norman", "Kapolei");
foreach ($arr_cities as $city) {
$cities_htm .= '
'.$html_snippet.'', "header" => array( "icon" => 'fa fa-code', "title" => '
HTML Output (Run Time: '.$run_time.')
' ) ); $_ui->create_widget($options, $contents)->color('pink')->print_html(); // print js $js_snippet = SmartUtil::clean_html_string($js); $js_contents = array( "body" => ''.$js_snippet.'', "header" => array( "icon" => 'fa fa-code', "title" => '
JS Output
' ) ); $_ui->create_widget($options, $js_contents)->color('green')->print_html(); ?>
parse($md);
echo str_replace('