public function dataTableProgress(DataTable $dt, $columnName, $color) { $i = 0; foreach ($dt->getColumnDefinitions() as $column) { if ($column['name'] == $columnName) { return '{ targets: ' . $i . ', render: function(data, type, row) { return \'<div class="progress progress-xs"><div class="progress-bar progress-bar-' . $color . '" style="width: \'+row[\'' . $columnName . '\']+\'%"></div></div>\'; } }, '; } $i++; } return ''; }