Skip to content

Commit 72e8e1f

Browse files
add column type constants
1 parent c41f6aa commit 72e8e1f

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

src/DataTable.php

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,19 @@
1111
use yii\base\Widget;
1212
use yii\helpers\ArrayHelper;
1313
use yii\helpers\Html;
14+
use yii\helpers\Inflector;
1415
use yii\helpers\Json;
1516
use yii\web\JsExpression;
16-
use yii\helpers\Inflector;
1717

1818
class DataTable extends Widget
1919
{
20+
const COLUMN_TYPE_DATE = 'date';
21+
const COLUMN_TYPE_NUM = 'num';
22+
const COLUMN_TYPE_NUM_FMT = 'num-fmt';
23+
const COLUMN_TYPE_HTML_NUM = 'html-num';
24+
const COLUMN_TYPE_HTML_NUM_FMT = 'html-num-fmt';
25+
const COLUMN_TYPE_STRING = 'string';
26+
2027
public $id;
2128
/**
2229
* @var boolean Feature control DataTables' smart column width handling
@@ -361,8 +368,8 @@ protected function initColumns()
361368
if (is_string($value)) {
362369
$this->columns[$key] = ['data' => $value, 'title' => Inflector::camel2words($value)];
363370
}
364-
if (isset($value['type'])){
365-
if ($value['type'] == 'link'){
371+
if (isset($value['type'])) {
372+
if ($value['type'] == 'link') {
366373
$value['class'] = LinkColumn::className();
367374
}
368375
}

0 commit comments

Comments
 (0)