本文整理汇总了PHP中GridView::widget方法的典型用法代码示例。如果您正苦于以下问题:PHP GridView::widget方法的具体用法?PHP GridView::widget怎么用?PHP GridView::widget使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GridView
的用法示例。
在下文中一共展示了GridView::widget方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: implode
$actions[] = '{delete}';
$showActions = $showActions || true;
}
if ($showActions === true) {
$gridConfig['columns'][] = ['class' => ActionColumn::className(), 'template' => implode(' ', $actions)];
}
$boxButtons = !empty($boxButtons) ? implode(' ', $boxButtons) : null;
?>
<div class="row">
<div class="col-xs-12">
<?php
Box::begin(['title' => $this->params['subtitle'], 'bodyOptions' => ['class' => 'table-responsive'], 'batchParam' => 'names', 'buttonsTemplate' => $boxButtons, 'grid' => $gridId]);
?>
<?php
echo GridView::widget($gridConfig);
?>
<?php
Box::end();
?>
</div>
</div>
<div class="row">
<div class="col-xs-12">
<?php
Box::begin(['title' => 'Items', 'bodyOptions' => ['class' => 'table-responsive']]);
?>
<div class="panel-group" id="roles" role="tablist" aria-multiselectable="true">
<?php
foreach ($rolesArray as $row) {
示例2: function
<?php
echo GridView::widget(['dataProvider' => $dataProvider, 'filterModel' => $searchModel, 'columns' => [['class' => 'yii\\grid\\SerialColumn'], 'id', 'drivers_title', 'drivers_name', 'drivers_lastname', 'drivers_passport', ['class' => 'yii\\grid\\ActionColumn']]]);
$this->registerJs("\n \$('#myModal').on('show.bs.modal', function (event) {\n var button = \$(event.relatedTarget)\n var modal = \$(this)\n var title = button.data('title') \n var href = button.attr('href') \n modal.find('.modal-title').html(title)\n modal.find('.modal-body').html('<i class=\"fa fa-spinner fa-spin\"></i>')\n \$.post(href)\n .done(function( data ) {\n modal.find('.modal-body').html(data)\n });\n })\n");
示例3: function
<?php
echo GridView::widget(['dataProvider' => $dataProvider, 'filterModel' => $searchModel, 'columns' => [['class' => 'yii\\grid\\SerialColumn'], 'nombre', ['attribute' => 'correo', 'value' => function ($searchModel) {
return Security::decrypt($searchModel->email);
}], 'comentario:ntext', ['attribute' => 'noticia_id', 'format' => 'raw', 'value' => function ($searchModel) {
return Html::a($searchModel->noticia->titulo, "@web/articulo/" . $searchModel->noticia->seo_slug);
}], ['attribute' => 'estado', 'format' => 'raw', 'value' => function ($searchModel) {
if ($searchModel->estado === 0) {
return "<span class='glyphicon glyphicon-remove'></span>";
} else {
return "<span class='glyphicon glyphicon-ok'></span>";
}
}], ['class' => 'yii\\grid\\ActionColumn', 'template' => '{update} {delete} {aprobar}', 'buttons' => ['aprobar' => function ($url, $model) {
if ($model->estado === 0) {
return Html::a('<span class="glyphicon glyphicon-thumbs-up"></span>', $url, ['title' => Yii::t('app', 'Aprobar comentario')]);
}
}, 'update' => function ($url, $model) {
return Html::a('<span class="glyphicon glyphicon-pencil"></span>', $url, ['title' => Yii::t('app', 'Actualizar')]);
}], 'urlCreator' => function ($action, $model, $key, $index) {
if ($action === 'aprobar') {
return yii\helpers\Url::to(['comentario/aprobar', 'id' => $key]);
} elseif ($action == 'update') {
return yii\helpers\Url::to(['comentario/update/', 'id' => $key]);
} elseif ($action === 'delete') {
return yii\helpers\Url::to(['comentario/delete/', 'id' => $key]);
}
}]]]);
示例4:
<?php
/*
* DAILY LOG PERSONAL ABSENSI
* PERIODE 23-22
* @author ptrnov [piter@lukison.com]
* @since 1.2
*/
echo GridView::widget(['id' => 'daily-personal-rekap', 'dataProvider' => $dataProvider, 'beforeHeader' => $getHeaderLabelWrap, 'columns' => $attDinamik, 'pjax' => true, 'pjaxSettings' => ['options' => ['enablePushState' => false, 'id' => 'absen-rekap']], 'panel' => ['heading' => '<h3 class="panel-title">DAILY ATTENDANCE PERIODE</h3>', 'type' => 'warning', 'showFooter' => false], 'toolbar' => [], 'hover' => true, 'responsive' => true, 'responsiveWrap' => true, 'bordered' => true, 'striped' => true]);
示例5:
<?php
/**
* @author Niko Gasco
* @copyright 2015
*/
use sjaakp\alphapager\AlphaPager;
AlphaPager::widget(['dataProvider' => $dataProvider]);
GridView::widget(['dataProvider' => $dataProvider, 'columns' => ['last_name', 'first_name']]);
示例6:
<?php
echo GridView::widget(['dataProvider' => $dataProvider, 'filterModel' => $searchModel, 'columns' => [['class' => 'yii\\grid\\SerialColumn'], 'title', 'description', 'created_at', 'created_by', ['class' => 'yii\\grid\\ActionColumn']]]);
示例7: rules
https://github.com/kartik-v/yii2-widget-select2
<?php
echo GridView::widget(['dataProvider' => $dataProvider, 'filterModel' => $searchModel, 'columns' => [['class' => 'yii\\grid\\SerialColumn'], 'titulo', ['attribute' => 'categoria_id', 'value' => 'categoria.categoria', 'format' => 'raw', 'filter' => Select2::widget(['model' => $searchModel, 'attribute' => 'categoria_id', 'data' => \yii\helpers\ArrayHelper::map(\app\models\Categoria::find()->all(), 'id', 'categoria'), 'options' => ['placeholder' => 'Seleccione...'], 'pluginOptions' => ['allowClear' => true]])], ['attribute' => 'created_by', 'value' => 'createdBy.name'], ['class' => 'yii\\grid\\ActionColumn']]]);
?>
---------------------------------------------------------------------------------------------------------------------------
public function rules()
{
return [
[['created_by', 'updated_by'], 'safe'],
];
}
...validate()...
$query->joinWith('createdBy');
->andFilterWhere(['like', 'user.name', $this->created_by])