PcLinkButton extension
This extension enables rendering a 'dynamic' image per row object in a grid view. The class provided by this extension, PcLinkButton, is a brother class to other *Column classes - CDataColumn, CLinkColumn, CButtonColumn and CCheckBoxColumn. What it provides is similar to the way "urlExpression" and "labelExpression" are evaluated in CLinkColumn: an ability to render "imageUrlExpression" per data object being rendered.
Not many I guess. Tested on Yii v1.1.10.
$this->widget('zii.widgets.grid.CGridView', array( 'id' => 'my-id', 'dataProvider' => $model->search(), 'filter' => $model, 'columns' => array( //... more columns array( 'class' => 'PcLinkButton', 'imageUrlExpression' => 'SomeModel::getWebPath($some_param) . basename($data->icon_filename)', 'urlExpression' => '"/pathTo/" . strtolower($data->name)', 'labelExpression' => '$data->name', 'header' => "Column Title, ),, ));
Be the first person to leave a comment
Please login to leave your comment.