本文整理汇总了PHP中kartik\grid\GridView类的典型用法代码示例。如果您正苦于以下问题:PHP GridView类的具体用法?PHP GridView怎么用?PHP GridView使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了GridView类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: run
public function run()
{
$ret_val = '';
if (isset($this->header) && is_string($this->header) && !is_bool($this->header)) {
$ret_val = Html::tag('h2', $this->header);
}
switch ($this->displayAs) {
case 'grid':
$this->items = is_array($this->items) ? $this->items : [$this->items];
$this->widgetOptions = array_merge(['summary' => false, 'layout' => '{items}', 'showHeader' => $this->header, 'dataProvider' => new \yii\data\ArrayDataProvider(['allModels' => $this->items]), 'columns' => $this->attributes], $this->widgetOptions);
$ret_val .= \kartik\grid\GridView::widget($this->widgetOptions);
break;
case 'list':
$this->widgetOptions = array_merge(['itemOptions' => ['tag' => false], 'summary' => false, 'dataProvider' => new \yii\data\ArrayDataProvider(['allModels' => $this->items]), 'itemView' => function ($model, $key, $index, $widget) {
return $this->renderListItem($model, $key, $index, $widget);
}], $this->widgetOptions);
$ret_val .= \yii\widgets\ListView::widget($this->widgetOptions);
break;
case 'csv':
$ret_val = [];
foreach ($this->items as $index => $item) {
$ret_val[] = $this->renderCsvItem($item, $index);
}
$ret_val = Html::tag('div', implode(', ', $ret_val));
break;
case 'tags':
foreach ($this->items as $index => $item) {
$ret_val .= $this->renderTagItem($item, $index);
}
$ret_val = Html::tag('div', $ret_val);
break;
default:
$this->widgetOptions['class'] = isset($this->widgetOptions['class']) ? $this->widgetOptions['class'] : 'table';
$this->widgetOptions = array_merge(['model' => $this->items, 'attributes' => $this->attributes, 'options' => ['class' => 'table']], $this->widgetOptions);
$ret_val .= \yii\widgets\DetailView::widget($this->widgetOptions);
break;
}
return $ret_val;
}
示例2: bootstrap
/** @inheritdoc */
public function bootstrap($app)
{
$configManager = Yii::$app->configManager;
$configManager->register('userGrid', GridView::classname(), ['persistResize' => true, 'pjax' => true, 'pjaxSettings' => ['neverTimeout' => true, 'loadingCssClass' => false, 'options' => ['scrollTo' => 0]], 'striped' => true, 'condensed' => false, 'bordered' => false, 'layout' => '
<div class="box-body">
{items}
</div>
<div class="box-footer clearfix">
<div class="pull-right">
{pager}
</div>
<div class="pull-left summary-wrapper">
{summary}
</div>
</div>']);
$configManager->register('userGridNameColumn', GridView::classname(), ['attribute' => 'username', 'format' => 'raw', 'hAlign' => GridView::ALIGN_LEFT, 'vAlign' => GridView::ALIGN_MIDDLE, 'value' => function ($model) {
return Html::a(isset($model->profile) ? $model->profile->name . ' (' . $model->username . ')' : $model->username, ['/management/user/update', 'id' => $model->id], ['data-pjax' => 0, 'data-toggle' => 'tooltip', 'data-placement' => 'right', 'data-html' => 'true', 'data-trigger' => 'hover click', 'title' => '<i class="glyphicon glyphicon-edit"> </i>' . ' ' . Yii::t('app', 'Edit')]);
}]);
$configManager->register('userGridBlockColumn', GridView::classname(), ['header' => 'Block status', 'format' => 'raw', 'hAlign' => GridView::ALIGN_CENTER, 'vAlign' => GridView::ALIGN_MIDDLE, 'value' => function ($model) {
if ($model->is(User::BLOCKED)) {
return Html::a('<i class="fa fa-unlock"></i>' . ' ' . 'Unblock', ['block', 'id' => $model->id], ['class' => 'btn btn-xs btn-success btn-block btn-flat', 'data-method' => 'post']);
} else {
return Html::a('<i class="fa fa-lock"></i>' . ' ' . 'Block', ['block', 'id' => $model->id], ['class' => 'btn btn-xs btn-danger btn-block btn-flat', 'data-method' => 'post']);
}
}]);
$configManager->register('userGridRoleColumn', GridView::classname(), ['header' => 'Role', 'format' => 'raw', 'hAlign' => GridView::ALIGN_CENTER, 'vAlign' => GridView::ALIGN_MIDDLE, 'value' => function ($model) {
return !empty(Yii::$app->authHelper->getRoleNameByUserId($model->id)) ? Html::tag('span', Yii::$app->authHelper->getRoleNameByUserId($model->id), ['class' => "label bg-default label-default"]) : null;
}]);
}
示例3: actionTitularidad
public function actionTitularidad($id_uf)
{
$UfModel = Uf::findOne($id_uf);
if (!empty($UfModel->ultUfTitularidad->id)) {
$query = UfTitularidadPersonas::find()->joinWith('persona')->where(['uf_titularidad_id' => $UfModel->ultUfTitularidad->id]);
$dataProvider = new ActiveDataProvider(['query' => $query, 'sort' => ['defaultOrder' => ['tipo' => SORT_DESC], 'enableMultiSort' => true]]);
$response = GridView::widget(['dataProvider' => $dataProvider, 'condensed' => true, 'layout' => '{items}', 'panel' => ['type' => GridView::TYPE_INFO, 'heading' => 'Titularidad actual sobre U.F.' . $id_uf, 'footer' => false, 'before' => false, 'after' => false], 'panelHeadingTemplate' => '{heading}', 'resizableColumns' => false, 'columns' => [['attribute' => 'tipo', 'value' => function ($model) {
return UfTitularidadPersonas::getTipos($model->tipo);
}], 'id_persona', 'persona.apellido', 'persona.nombre', 'persona.nombre2', 'persona.tipoDoc.desc_tipo_doc_abr', 'persona.nro_doc']]);
} else {
$response = '';
}
\Yii::$app->response->format = 'json';
return $response;
}
示例4: function
<?php
use yii\helpers\Html;
use kartik\grid\GridView;
/* @var $this yii\web\View */
/* @var $searchModel common\models\search\MemberSerach */
/* @var $dataProvider yii\data\ActiveDataProvider */
$this->title = '全部会员';
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="member-index">
<h1><?php
echo Html::encode($this->title);
?>
</h1>
<?php
echo GridView::widget(['dataProvider' => $dataProvider, 'filterModel' => $searchModel, 'layout' => '{items} {summary} {pager}', 'pjax' => true, 'columns' => [['class' => 'yii\\grid\\SerialColumn'], 'username', 'nickname', 'identity', ['attribute' => 'bank', 'value' => function ($model) {
return Yii::$app->options->getOptionLabel('bank', $model->bank);
}, 'filter' => Yii::$app->options->getOptions('bank', true)], 'cardname', 'cardnumber', 'bankaddress', 'phone', ['attribute' => 'role_id', 'label' => '状态', 'value' => function ($model) {
return Yii::$app->options->getOptionLabel('role', $model->role_id);
}, 'filter' => Yii::$app->options->getOptions('role', true)]]]);
?>
</div>
示例5: function
</div>
</div>
</div>
<?php
$form->end();
?>
<?php
?>
<?php
echo \kartik\grid\GridView::widget(['dataProvider' => $dataProvider, 'filterModel' => $model, 'columns' => [['class' => SerialColumn::className()], ['class' => \kartik\grid\CheckboxColumn::className()], 'user_id', 'user_name', 'email', ['class' => CheckboxColumn::className(), 'class' => DataColumn::className(), 'attribute' => 'is_validated', 'format' => 'html', 'value' => function ($model) {
return $this->render('list_item.php', ['model' => $model, 'action' => 'is_validated']);
}], 'user_money', 'frozen_money', 'rank_points', 'pay_points', 'reg_time', ['class' => DataColumn::className(), 'format' => 'html', 'attribute' => Yii::$app->params['lang']['handler'], 'value' => function ($model) {
return $this->render('list_item.php', ['model' => $model, 'action' => 'handler']);
}]]]);
?>
</div>
</div>
示例6: json_encode
// echo $this->render('_search', ['model' => $searchModel]);
?>
<?php
/*<p>
<?= Html::a(Yii::t('gromver.platform', 'Create {modelClass}', [
'modelClass' => 'Tag',
]), ['create'], ['class' => 'btn btn-success']) ?>
</p>*/
?>
<?php
echo GridView::widget(['id' => 'table-grid', 'dataProvider' => $dataProvider, 'filterModel' => $searchModel, 'pjax' => true, 'pjaxSettings' => ['neverTimeout' => true], 'columns' => [['class' => 'yii\\grid\\CheckboxColumn'], ['attribute' => 'id', 'width' => '50px'], ['attribute' => 'language', 'width' => '80px', 'value' => function ($model) {
/** @var $model \gromver\platform\common\models\Tag */
return \gromver\platform\backend\widgets\Translator::widget(['model' => $model]);
}, 'format' => 'html', 'filter' => Yii::$app->getLanguagesList()], 'title', 'alias', ['attribute' => 'group', 'filter' => \yii\helpers\ArrayHelper::map(\gromver\platform\common\models\Tag::find()->groupBy('group')->andWhere('[[group]]!="" AND [[group]] IS NOT NULL')->all(), 'group', 'group')], ['attribute' => 'status', 'value' => function ($model) {
/** @var $model \gromver\platform\common\models\Tag */
return $model->status === \gromver\platform\common\models\Tag::STATUS_PUBLISHED ? Html::a('<i class="glyphicon glyphicon-ok-circle"></i>', \yii\helpers\Url::to(['unpublish', 'id' => $model->id]), ['class' => 'btn btn-default btn-xs', 'data-pjax' => '0', 'data-method' => 'post']) : Html::a('<i class="glyphicon glyphicon-remove-circle"></i>', \yii\helpers\Url::to(['publish', 'id' => $model->id]), ['class' => 'btn btn-default btn-xs', 'data-pjax' => '0', 'data-method' => 'post']);
}, 'filter' => \gromver\platform\common\models\Tag::statusLabels(), 'format' => 'raw', 'width' => '80px'], ['class' => 'kartik\\grid\\ActionColumn', 'deleteOptions' => ['data-method' => 'delete']]], 'responsive' => true, 'hover' => true, 'condensed' => true, 'floatHeader' => true, 'bordered' => false, 'panel' => ['heading' => '<h3 class="panel-title"><i class="glyphicon glyphicon-th-list"></i> ' . Html::encode($this->title) . ' </h3>', 'type' => 'info', 'before' => Html::a('<i class="glyphicon glyphicon-plus"></i> ' . Yii::t('gromver.platform', 'Add'), ['create'], ['class' => 'btn btn-success', 'data-pjax' => 0]), 'after' => Html::a('<i class="glyphicon glyphicon-trash"></i> ' . Yii::t('gromver.platform', 'Delete'), ['bulk-delete'], ['class' => 'btn btn-danger', 'data-pjax' => '0', 'onclick' => 'processAction(this); return false']) . ' ' . Html::a('<i class="glyphicon glyphicon-repeat"></i> ' . Yii::t('gromver.platform', 'Reset List'), ['index'], ['class' => 'btn btn-info']), 'showFooter' => false]]);
?>
</div>
<script>
function processAction(el) {
var $el = $(el),
$grid = $('#table-grid'),
selection = $grid.yiiGridView('getSelectedRows')
if(!selection.length) {
alert(<?php
echo json_encode(Yii::t('gromver.platform', 'Select items.'));
?>
示例7:
<?php
use yii\helpers\Html;
use kartik\grid\GridView;
/* @var $this yii\web\View */
/* @var $searchModel star\account\models\ActivitySearch */
/* @var $dataProvider yii\data\ActiveDataProvider */
$this->title = Yii::t('account', 'Activities');
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="activity-index">
<h1><?php
echo Html::encode($this->title);
?>
</h1>
<?php
// echo $this->render('_search', ['model' => $searchModel]);
?>
<?php
echo GridView::widget(['dataProvider' => $dataProvider, 'filterModel' => $searchModel, 'columns' => [['class' => 'yii\\grid\\SerialColumn'], 'activity_type', 'activity_send_type', 'activity_send_value', 'vaild_date', 'create_time:datetime', 'update_time:datetime', ['class' => 'yii\\grid\\ActionColumn', 'template' => '<div style="width: 30px">{update} {delete}</div>']], 'export' => false, 'responsive' => true, 'toolbar' => Html::a(Yii::t('p2p_activity', 'Create Activity'), ['create'], ['class' => 'btn btn-info']), 'containerOptions' => ['style' => 'overflow: auto'], 'headerRowOptions' => ['class' => 'kartik-sheet-style'], 'filterRowOptions' => ['class' => 'kartik-sheet-style'], 'panelHeadingTemplate' => '<h3 class="panel-title"><i class="glyphicon glyphicon-globe"></i> ' . Html::encode($this->title) . '</h3>', 'panel' => ['type' => GridView::TYPE_DEFAULT, 'after' => false, 'footer' => false]]);
?>
</div>
示例8:
<?php
use yii\helpers\Html;
use kartik\grid\GridView;
use yii\widgets\Pjax;
/**
* @var yii\web\View $this
* @var yii\data\ActiveDataProvider $dataProvider
* @var app\models\AddressSearch $searchModel
*/
?>
<div class="address-grid">
<?php
Pjax::begin();
echo GridView::widget(['dataProvider' => $dataProvider, 'filterModel' => $searchModel, 'responsive' => true, 'hover' => true, 'columns' => [['class' => 'yii\\grid\\SerialColumn'], 'zipCode', 'cityName', 'addresslineOne', 'addresslineTwo', ['class' => 'yii\\grid\\ActionColumn']]]);
Pjax::end();
?>
</div>
示例9: function
return Html::a('<i class="glyphicon glyphicon-thumbs-down"></i> REJECT', '#', ['class' => 'btn btn-danger btn-xs', 'style' => ['width' => '100px'], 'title' => 'Detail']);
} else {
return Html::a('<i class="glyphicon glyphicon-question-sign"></i> UNKNOWN', '#', ['class' => 'btn btn-danger btn-xs', 'style' => ['width' => '100px'], 'title' => 'Detail']);
}
}
$Combo_Dept = ArrayHelper::map(Dept::find()->orderBy('SORT')->asArray()->all(), 'DEP_NM', 'DEP_NM');
?>
<div style="padding:10px;">
<?php
echo GridView::widget(['id' => 'ro-grd-index', 'dataProvider' => $dataProvider, 'filterModel' => $searchModel, 'columns' => [['class' => 'kartik\\grid\\SerialColumn', 'contentOptions' => ['class' => 'kartik-sheet-style'], 'width' => '20px', 'header' => 'No.', 'headerOptions' => ['class' => 'kartik-sheet-style']], ['attribute' => 'KD_SA', 'hAlign' => 'left', 'vAlign' => 'middle', 'group' => true], ['label' => 'Tanggal Pembuatan', 'attribute' => 'CREATED_AT', 'hAlign' => 'left', 'vAlign' => 'middle', 'group' => true, 'filterType' => \kartik\grid\GridView::FILTER_DATE_RANGE, 'filterWidgetOptions' => ['attribute' => 'parentro.CREATED_AT', 'presetDropdown' => TRUE, 'convertFormat' => true, 'pluginOptions' => ['id' => 'tglro', 'format' => 'Y/m/d', 'separator' => 'TO', 'opens' => 'left']]], ['label' => 'Pengajuan', 'group' => true, 'attribute' => 'EMP_NM', 'hAlign' => 'left', 'vAlign' => 'middle'], ['label' => 'Department', 'group' => true, 'attribute' => 'dept.DEP_NM', 'hAlign' => 'left', 'vAlign' => 'middle', 'filter' => $Combo_Dept], ['class' => 'kartik\\grid\\ActionColumn', 'dropdown' => true, 'template' => '{view}{tambahEdit}{delete}{approved}', 'dropdownOptions' => ['class' => 'pull-right dropup'], 'buttons' => ['view' => function ($url, $model) {
return tombolView($url, $model);
}, 'tambahEdit' => function ($url, $model) {
return tombolEdit($url, $model);
}, 'delete' => function ($url, $model) {
return tombolDelete($url, $model);
}, 'approved' => function ($url, $model) {
return tombolApproval($url, $model);
}]], ['label' => 'Notification', 'mergeHeader' => true, 'format' => 'raw', 'hAlign' => 'center', 'value' => function ($model) {
return statusProcessRo($model);
}]], 'pjax' => true, 'pjaxSettings' => ['options' => ['enablePushState' => false, 'id' => 'sa-grd-index']], 'hover' => true, 'responsive' => true, 'responsiveWrap' => true, 'bordered' => true, 'striped' => '4px', 'autoXlFormat' => true, 'export' => false, 'toolbar' => [['content' => tombolCreate() . tombolBarang() . tombolKategori()], '{toggleData}'], 'panel' => ['type' => GridView::TYPE_INFO, 'heading' => "List Sales Order"]]);
?>
<?php
$this->registerJs("\r\n\t\t\t\$.fn.modal.Constructor.prototype.enforceFocus = function() {};\t\r\n\t\t\t\$('#new-sa').on('show.bs.modal', function (event) {\r\n\t\t\t\tvar button = \$(event.relatedTarget)\r\n\t\t\t\tvar modal = \$(this)\r\n\t\t\t\tvar title = button.data('title') \r\n\t\t\t\tvar href = button.attr('href') \r\n\t\t\t\tmodal.find('.modal-title').html(title)\r\n\t\t\t\tmodal.find('.modal-body').html('<i class=\"fa fa-spinner fa-spin\"></i>')\r\n\t\t\t\t\$.post(href)\r\n\t\t\t\t\t.done(function( data ) {\r\n\t\t\t\t\t\tmodal.find('.modal-body').html(data)\t\t\t\t\t\r\n\t\t\t\t\t});\r\n\t\t\t\t}),\t\t\t\r\n\t\t", $this::POS_READY);
Modal::begin(['id' => 'new-sa', 'header' => '<div style="float:left;margin-right:10px" class="fa fa-2x fa-book"></div><div><h4 class="modal-title">Entry Sales Order</h4></div>', 'size' => 'modal-md', 'headerOptions' => ['style' => 'border-radius:5px; background-color: rgba(131, 160, 245, 0.5)']]);
Modal::end();
$this->registerJs("\r\n\t\t\t\$.fn.modal.Constructor.prototype.enforceFocus = function() {};\t\r\n\t\t\t\$('#add-sa').on('show.bs.modal', function (event) {\r\n\t\t\t\tvar button = \$(event.relatedTarget)\r\n\t\t\t\tvar modal = \$(this)\r\n\t\t\t\tvar title = button.data('title') \r\n\t\t\t\tvar href = button.attr('href') \r\n\t\t\t\tmodal.find('.modal-title').html(title)\r\n\t\t\t\tmodal.find('.modal-body').html('<i class=\"fa fa-spinner fa-spin\"></i>')\r\n\t\t\t\t\$.post(href)\r\n\t\t\t\t\t.done(function( data ) {\r\n\t\t\t\t\t\tmodal.find('.modal-body').html(data)\t\t\t\t\t\r\n\t\t\t\t\t});\r\n\t\t\t\t}),\t\t\t\r\n\t\t", $this::POS_READY);
Modal::begin(['id' => 'add-sa', 'header' => '<h4 class="modal-title">Entry Sales Order</h4>', 'size' => 'modal-lg', 'headerOptions' => ['style' => 'border-radius:5px; background-color:rgba(230, 251, 225, 1);']]);
Modal::end();
示例10: function
$actionCol = ['class' => 'kartik\\grid\\ActionColumn', 'template' => '{flight}', 'buttons' => ['flight' => function ($url, $model) {
return Html::a('<span class="glyphicon glyphicon-calendar"></span>', $url, ['title' => Yii::t('igolf', 'Make Flights')]);
}], 'urlCreator' => function ($action, $model, $key, $index) {
if (in_array($action, array('flight'))) {
return Url::to(['flight/competition', 'id' => $model->id]);
}
}];
?>
<div class="competition-index">
<h1><?php
echo Html::encode($this->title);
?>
</h1>
<p>
<?php
echo Html::a(Yii::t('igolf', 'Create {modelClass}', ['modelClass' => 'Competition']), ['create'], ['class' => 'btn btn-success']);
?>
</p>
<?php
echo GridView::widget(['dataProvider' => $dataProvider, 'filterModel' => $searchModel, 'columns' => [['class' => 'kartik\\grid\\SerialColumn'], ['label' => Yii::t('igolf', 'Part of'), 'value' => function ($model, $key, $index, $widget) {
return $model->name . ' (' . Yii::t('igolf', $model->competition_type) . ')';
}], 'description', ['label' => Yii::t('igolf', 'Part of'), 'value' => function ($model, $key, $index, $widget) {
return $model->parent ? $model->parent->name . ' (' . Yii::t('igolf', $model->parent->competition_type) . ')' : '-';
}], 'registration_end', $actionCol]]);
?>
</div>
示例11:
use yii\helpers\Html;
use kartik\grid\GridView;
/* @var $this yii\web\View */
/* @var $searchModel app\models\TimesheetSearch */
/* @var $dataProvider yii\data\ActiveDataProvider */
$this->title = 'Timesheets';
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="timesheet-index">
<h1><?php
echo Html::encode($this->title);
?>
</h1>
<?php
// echo $this->render('_search', ['model' => $searchModel]);
?>
<p>
<?php
echo Html::a('Create Timesheet', ['create'], ['class' => 'btn btn-success']);
?>
</p>
<?php
echo GridView::widget(['dataProvider' => $dataProvider, 'filterModel' => $searchModel, 'responsive' => TRUE, 'hover' => TRUE, 'columns' => [['class' => 'yii\\grid\\SerialColumn'], 'id', 'user_id', 'point', 'director_comment', 'date', ['class' => 'yii\\grid\\ActionColumn']]]);
?>
</div>
示例12:
$dateColumn = ['attribute' => 'FDATE', 'value' => 'FDATE', 'filterType' => GridView::FILTER_DATE, 'filterWidgetOptions' => ['type' => DatePicker::TYPE_INPUT, 'pluginOptions' => ['autoclose' => true, 'format' => 'yyyy-mm-dd', 'endDate' => "+0D"]], 'format' => 'html'];
$dateColumnDisabled = ['attribute' => 'FDATE', 'value' => 'FDATE', 'format' => 'html', 'filterInputOptions' => ['disabled' => true, 'class' => 'form-control']];
/* @var $this yii\web\View */
/* @var $balanceSearchModel app\models\search\BalanceSearch */
/* @var $balanceDataProvider yii\data\ActiveDataProvider */
/* @var $coordinatesSearchModel app\models\search\CoordinatesSearch */
/* @var $coordinatesDataProvider yii\data\ActiveDataProvider */
/* @var $gadataextSearchModel app\models\search\GadataextSearch */
/* @var $gadataextDataProvider yii\data\ActiveDataProvider */
?>
<div class="device-parameters-index grid-margin">
<?php
echo GridView::widget(['dataProvider' => $gadataextDataProvider, 'filterModel' => $gadataextSearchModel, 'columns' => [['attribute' => 'GAID', 'filter' => Gadataext::getGaids(), 'width' => '120px', 'filterInputOptions' => ['disabled' => true, 'class' => 'form-control']], $dateColumn, 'KO2', 'KCO', 'KNO', 'K11', 'KCO2', 'KCH4', 'KSO2'], 'resizableColumns' => false, 'pjax' => true, 'pjaxSettings' => ['options' => ['id' => 'gadataext-pjax-container']], 'panel' => ['type' => GridView::TYPE_PRIMARY, 'heading' => '<h3 class="panel-title"><i class="fa fa-table fa-fw"></i> Коэффициенты</h3>', 'footer' => false], 'beforeHeader' => ['{pager}'], 'panelBeforeTemplate' => '<div>{pager}</div>']);
?>
<div class="row">
<div class="col-md-6">
<?php
echo GridView::widget(['dataProvider' => $balanceDataProvider, 'filterModel' => $balanceSearchModel, 'columns' => [['attribute' => 'GAID', 'filter' => Balance::getGaids(), 'width' => '120px', 'filterInputOptions' => ['disabled' => true, 'class' => 'form-control']], $dateColumnDisabled, ['attribute' => 'BAL', 'filterInputOptions' => ['disabled' => true, 'class' => 'form-control']]], 'resizableColumns' => false, 'pjax' => true, 'pjaxSettings' => ['options' => ['id' => 'balance-pjax-container']], 'panel' => ['type' => GridView::TYPE_PRIMARY, 'heading' => '<h3 class="panel-title"><i class="fa fa-table fa-fw"></i> Баланс</h3>', 'footer' => false], 'beforeHeader' => ['{pager}'], 'panelBeforeTemplate' => '<div>{pager}</div>']);
?>
</div>
<div class="col-md-6">
<?php
echo GridView::widget(['dataProvider' => $coordinatesDataProvider, 'filterModel' => $coordinatesSearchModel, 'columns' => [['attribute' => 'GAID', 'filter' => Coordinates::getGaids(), 'width' => '120px', 'filterInputOptions' => ['disabled' => true, 'class' => 'form-control']], $dateColumnDisabled, ['attribute' => 'longitude', 'filterInputOptions' => ['disabled' => true, 'class' => 'form-control']], ['attribute' => 'latitude', 'filterInputOptions' => ['disabled' => true, 'class' => 'form-control']]], 'resizableColumns' => false, 'pjax' => true, 'pjaxSettings' => ['options' => ['id' => 'coordinates-pjax-container']], 'panel' => ['type' => GridView::TYPE_PRIMARY, 'heading' => '<h3 class="panel-title"><i class="fa fa-table fa-fw"></i> Координаты</h3>', 'footer' => false], 'beforeHeader' => ['{pager}'], 'panelBeforeTemplate' => '<div>{pager}</div>']);
?>
</div>
</div>
</div>
示例13: function
use yii\bootstrap\ActiveForm;
use kartik\tabs\TabsX;
use yii\helpers\Json;
use yii\web\Response;
use yii\helpers\ArrayHelper;
use yii\web\Request;
use kartik\daterange\DateRangePicker;
use yii\db\ActiveRecord;
use yii\data\ArrayDataProvider;
/*[4] GRID VIEW IMAGE SHOW */
$visitImage = GridView::widget(['id' => 'img-list', 'rowOptions' => function ($model, $key, $index, $grid) {
return ['id' => $model['ID'], 'onclick' => '
$(document).ready(function(){
var mtgl="' . $model["TGL"] . '";
var muser_id="' . $model["USER_ID"] . '";
//alert(user_id);
$.fn.modal.Constructor.prototype.enforceFocus = function(){};
// e.preventDefault();
$("#modal-view").modal("show")
.find("#modalContent")
.load("/mastercrm/review-visit/disply-image?tgl=' . $model["TGL"] . '&user_id=' . $model["USER_ID"] . '");
});
'];
}, 'dataProvider' => $dataProviderHeader2, 'columns' => [['class' => 'kartik\\grid\\SerialColumn', 'width' => '10px', 'header' => 'No.', 'headerOptions' => ['style' => ['text-align' => 'center', 'width' => '10px', 'font-family' => 'verdana, arial, sans-serif', 'font-size' => '9pt', 'background-color' => 'rgba(249,215,100,1)']], 'contentOptions' => ['style' => ['text-align' => 'center', 'width' => '10px', 'font-family' => 'tahoma, arial, sans-serif', 'font-size' => '9pt']]], ['attribute' => 'IMG_DECODE_START', 'format' => 'raw', 'label' => 'Image Start', 'value' => function ($model) {
$base64 = 'data:image/jpg;charset=utf-8;base64,' . $model['IMG_DECODE_START'];
return $model['IMG_DECODE_START'] != '' ? Html::img($base64, ['width' => '120', 'height' => '120']) : Html::img($model['noImage'], ['width' => '120', 'height' => '120']);
}, 'headerOptions' => ['style' => ['text-align' => 'center', 'width' => '10px', 'font-family' => 'tahoma, arial, sans-serif', 'font-size' => '9pt', 'background-color' => 'rgba(74, 206, 231, 1)']], 'contentOptions' => ['style' => ['text-align' => 'center', 'width' => '10px', 'height' => '10px', 'font-family' => 'tahoma, arial, sans-serif', 'font-size' => '9pt']]], ['attribute' => 'IMG_DECODE_END', 'format' => 'raw', 'label' => 'Image End', 'value' => function ($model) {
$base64 = 'data:image/jpg;charset=utf-8;base64,' . $model['IMG_DECODE_END'];
return $model['IMG_DECODE_END'] != '' ? Html::img($base64, ['width' => '120', 'height' => '120']) : Html::img($model['noImage'], ['width' => '120', 'height' => '120']);
}, 'headerOptions' => ['style' => ['text-align' => 'center', 'width' => '10px', 'font-family' => 'tahoma, arial, sans-serif', 'font-size' => '9pt', 'background-color' => 'rgba(74, 206, 231, 1)']], 'contentOptions' => ['style' => ['text-align' => 'center', 'width' => '10px', 'height' => '10px', 'font-family' => 'tahoma, arial, sans-serif', 'font-size' => '9pt']]]], 'toolbar' => [''], 'panel' => ['heading' => "<i class='fa fa-file-image-o fa-1x'></i> LIST IMAGES", 'type' => 'danger', 'footer' => false]]);
echo $visitImage;
示例14:
<?php
use yii\helpers\Html;
use kartik\grid\GridView;
use kartik\export\ExportMenu;
/* @var $this yii\web\View */
/* @var $searchModel common\models\IncentiveSearch */
/* @var $dataProvider yii\data\ActiveDataProvider */
$this->title = 'Incentives';
$this->params['breadcrumbs'][] = $this->title;
// echo $this->render('_search', ['model' => $searchModel]);
$exportedValues = [['class' => 'kartik\\grid\\SerialColumn'], ['attribute' => 'deduction_date'], ['attribute' => 'deduction_amount'], ['attribute' => 'deduction_remark'], ['class' => 'kartik\\grid\\ActionColumn']];
$export = ExportMenu::widget(['dataProvider' => $dataProvider, 'columns' => $exportedValues, 'noExportColumns' => [0, 3], 'columnSelectorOptions' => ['label' => 'Columns', 'class' => 'btn btn-danger'], 'target' => '_blank', 'fontAwesome' => true, 'dropdownOptions' => ['label' => 'Export', 'class' => 'btn btn-success']]);
?>
<div class="incentive-index">
<?php
?>
<?php
echo GridView::widget(['dataProvider' => $dataProvider, 'filterModel' => $searchModel, 'pjax' => true, 'pjaxSettings' => ['neverTimeout' => true], 'columns' => $exportedValues]);
?>
</div>
示例15: renderItems
/**
* Renders the data models for the grid view.
*/
public function renderItems()
{
/*
$content = array_filter([
$this->renderCaption(),
$this->renderColumnGroup(),
$this->showHeader ? $this->renderTableHeader() : false,
$this->showFooter ? $this->renderTableFooter() : false,
$this->renderTableBody(),
]);
$table = Html::tag('table', implode("\n", $content), $this->tableOptions);
if ($this->responsive)
{
$table = Html::tag('div', $table, ['class' => 'table-responsive']);
}
else
{
$table = Html::tag('div', $table, ['class' => 'table-scrollable']);
}
return $table;
*
*/
return parent::renderItems();
}