"url"), leave url empty if no url //$breadcrumbs["New Crumb"] => "http://url.com" $breadcrumbs["Smart UI"] = ""; include("inc/ribbon.php"); ?>
create_datatable($data, array("in_widget" => true)); $dt->options("checkboxes", true); $dt->options("row_details", '
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 .= '
  • '; } // add a filter dropdown $widget->header("toolbar", array('
    ' )); // print it! $html = $dt->print_html(true); // return html // configure JS // setup additional datatable js properties $dt->js("properties", array( 'fnCreatedRow' => 'function( nRow, aData, iDataIndex ) { var cell = $("td:eq(7)", nRow); var city = aData[7]; if ( city == "Abbotsford" || city == "Baranello" ) { cell.html(city + \' great city\'); } }', 'sDom' => "\"<'dt-toolbar'<'col-xs-6'f><'col-xs-6 hidden-xs'B>r>\"+ \"t\"+ \"<'dt-toolbar-footer'<'col-xs-6'i><'col-xs-6'p>>\"", 'buttons' => "[ { extend: 'copy', className: 'btn btn-default' }, { extend: 'csv', className: 'btn btn-default' }, { extend: 'excel', className: 'btn btn-default' }, { extend: 'pdf', className: 'btn btn-default' }, { extend: 'print', className: 'btn btn-default' }, ]", 'autoWidth' => 'true' )); $dt->js("custom", 'function getTypeFilters() { var aSearchTypes = []; $("input[data-status-filter]").each(function(index, value) { if ($(this).prop("checked")) { var city = $(this).val(); aSearchTypes.push(city); } }) return aSearchTypes; } $("input[data-status-filter]").on("click", function() { var filters = getTypeFilters(); '.$dt->js("oTable").'.fnFilter(filters.join("|"), 7, true, false); })' ); // print JS content $js = $dt->print_js(true); $run_time = $_ui->run_time(false); echo $html; ?>
    false, "colorbutton" => false, "collapsed" => true ); // print html output $hb = new HTMLIndent(); $html_snippet = SmartUtil::clean_html_string($hb->indent($html), false); $contents = array( "body" => '
    '.$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('