Simple colum formatting in Yii 2 GridView

A very important widget in the business apps development is the GridView control. In this post I will show how to use its hidden capabilities to format the displayed data.

<?= GridView::widget([
 'dataProvider' => $dataProvider,
'columns' => [
 'Title', // same as 'Title:text'
 'Snippet:html', // will be HTML purified
 'Description:ntext', // plaintext but new lines as <br>
 'Email:email', // will be shown as mailto: link
 'WebSite:url', // will be shown as hyperlink
 'Picture:image', // <img src="value of Picture column" />
 'Maried:boolean', // true or false
 'Birthdate:date',
 'Birthdate:time',
 'Birthdate:datetime',
 'Birthdate:timestamp',
 'Size:integer',
 'Cost:spellout', // number as text
 'DiskSize:size', // as bytes, for example `12 kilobytes`
 'Size:decimal',
 'Ratio:percent',
 ]
);
?>
上一篇:CentOS7 上以 RPM 包方式安装 Oracle 18c 单实例


下一篇:(十)Linux内核中的常用宏container_of