<table class="text">
<tr class="li1"><td class="ln"><pre class="de1">1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106 $dataProvider, 'filterModel'=>$searchModel, 'showPageSummary'=>true, 'pjax'=>true, 'hover'=>true, 'panel'=>['type'=>'info','heading'=>'Group 例子'],//type:配置表单主题;heading:配置表头文字 'columns'=>[ ['class'=>'kartik\grid\SerialColumn'], [ 'attribute' => 't_company', 'width'=>'300px', 'noWrap'=>true, 'contentOptions' => ['class'=>'kv-align-middle'], 'format'=>'raw', 'group'=>true, // 打开关闭分组 // 'groupedRow'=>true,//按分组换行 // 'groupOddCssClass'=>'kv-grouped-row', // 给组加class // 'groupEvenCssClass'=>'kv-grouped-row',// 给组下的元素加class // 'groupFooter'=>function ($model,$key,$index,$widget) { // 在组的底部显示分类统计 // return [ // 'mergeColumns'=>[[2,3]],// 字段行合并 // 'content'=>[ // content to show in each summary cell // 1=>'Summary (' . $model->t_company . ')', // 4=>GridView::F_AVG, // 5=>GridView::F_SUM, // 6=>GridView::F_SUM, // ], // 'contentFormats'=>[ // content reformatting for each summary cell // 4=>['format'=>'number','decimals'=>2], // 5=>['format'=>'number','decimals'=>0], // 6=>['format'=>'number', // 'contentOptions'=>[ // content html attributes for each summary cell // 1=>['style'=>'font-variant:small-caps'], // 4=>['style'=>'text-align:right'], // 5=>['style'=>'text-align:right'], // 6=>['style'=>'text-align:right'], // // html attributes for group summary row // 'options'=>['class'=>'danger','style'=>'font-weight:bold;'] // ]; // }, 'subGroupOf'=>5,// supplier column index is the parent group 'value' => function($model){ if(empty($model->t_company)){ return ''; } if(AccessAuthService::hasAuth('sales','view')){ return 't_company.''; }else{ return 't_company.''; } } ], [ 'attribute'=>'t_tel', 'width'=>'250px', 'value'=>function ($model,$widget) { return $model->t_tel; }, 'filterType'=>GridView::FILTER_SELECT2, 'filterWidgetOptions'=>[ 'pluginOptions'=>['allowClear'=>true], ], 'filterInputOptions'=>['placeholder'=>'Any category'], 'group'=>false, // enable grouping 'subGroupOf'=>1,// supplier column index is the parent group 'pageSummary'=>'统计', ], [ 'attribute'=>'t_status', // 'mergeHeader'=>true,//合并表头 'format'=>['decimal',2],//参数说明:[字段类型,保留小数点位数] 'hAlign'=>'right',//设置单元格内容左右的位置 'pageSummary'=>true, 'pageSummaryFunc'=>GridView::F_SUM,//列求和(pageSummaryFunc:不设置默认求和) 'pageSummaryOptions'=>['class'=>'text-right text-warning'], [ 'attribute'=>'t_fenlei', 'width'=>'150px', 'hAlign'=>'right', 'format'=>['decimal', 'pageSummary'=>true, 'pageSummaryFunc'=>GridView::F_AVG //列求平均 ], [ 'class'=>'kartik\grid\FormulaColumn', 'header'=>'Amount In Stock',$widget) { $p = compact('model','key','index'); // return $widget->col(4,$p) * $widget->col(5,$p); }, 'mergeHeader'=>true, 'pageSummary'=>true ], ],]); ?> 原文链接:https://www.f2er.com/note/421261.html