本文整理汇总了PHP中yii\grid\GridView::init方法的典型用法代码示例。如果您正苦于以下问题:PHP GridView::init方法的具体用法?PHP GridView::init怎么用?PHP GridView::init使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类yii\grid\GridView
的用法示例。
在下文中一共展示了GridView::init方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: init
/**
* Inits widget
*/
public function init()
{
parent::init();
$this->initVisible();
$this->initSortable();
//GridViewAsset::register($this->view);
}
示例2: init
public function init()
{
parent::init();
if (!$this->options['ajax']) {
echo '<div id="box-' . $this->id . '" class="box box-primary">' . ' <div class="box-header with-border">';
if (isset($this->options['boxTitle'])) {
echo Html::tag('h3', '<i class="fa fa-list"></i> ' . $this->options['boxTitle'], ['class' => 'box-title']);
}
echo '<div class="box-tools pull-right">';
if (isset($this->options['buttonUp'])) {
echo Html::a('<i class="fa fa-arrow-up"></i>', $this->options['buttonUp'], ['id' => 'button-up', 'class' => 'btn btn-sm btn-default', 'title' => \Yii::t('theme/widgets/box', 'Up')]);
echo ' ';
}
if (isset($this->options['buttonCreate'])) {
echo Html::a('<i class="fa fa-plus"></i>', $this->options['buttonCreate'], ['class' => 'btn btn-sm btn-primary', 'title' => \Yii::t('theme/widgets/box', 'Create')]);
echo ' ';
}
if (isset($this->options['buttonDelete'])) {
echo Html::a('<i class="fa fa-trash-o"></i>', $this->options['buttonDelete'], ['id' => 'batch-delete', 'class' => 'btn btn-sm btn-danger', 'title' => \Yii::t('theme/widgets/box', 'Delete')]);
echo ' ';
}
if (isset($this->options['buttonUndo'])) {
echo Html::a('<i class="fa fa-undo"></i>', $this->options['buttonUndo'], ['class' => 'btn btn-sm btn-default', 'title' => \Yii::t('theme/widgets/box', 'Undo')]);
echo ' ';
}
echo '</div>';
echo '</div>';
echo '<div class="box-body">';
$this->renderFiltersForm();
}
echo "<div id='table-{$this->id}'>";
}
示例3: init
public function init()
{
parent::init();
$this->emptyText = Html::t('templete', 'noData');
$this->summary = Html::t('templete', 'summary');
$this->getView()->registerCssFile('/css/listStyle.css');
}
示例4: init
public function init()
{
parent::init();
if ($this->ajaxPager) {
$this->pager['targetId'] = $this->id;
}
}
示例5: init
public function init()
{
$this->tableOptions = ['class' => 'table ' . $this->type];
$this->dataProvider = new ArrayDataProvider(['allModels' => $this->data, 'pagination' => false]);
$this->layout = '{items}';
parent::init();
}
示例6: init
public function init()
{
$this->showHeader = false;
$this->showFooter = false;
$this->layout = '{items}';
$this->columns = [['class' => 'yii\\grid\\DataColumn', 'format' => 'raw', 'value' => function ($post) {
foreach ($post->postDates as $postDate) {
if (!isset($first)) {
$first = $postDate->PostDate;
}
$last = $postDate->PostDate;
}
if ($first == $last) {
$value = $first;
} else {
$value = $first . ' — ' . $last;
}
if ($post->PostText) {
$value = $value . '<br />' . $post->PostText;
}
return $value;
}], ['format' => 'raw', 'value' => function ($post) {
return '<span class="js-past_vacation_delete grid_delete_icon" data-post-id="' . $post->PostID . '"><i class="fa fa-trash"></i></span>';
}]];
parent::init();
}
示例7: init
/**
* @inheritdoc
*/
public function init()
{
if (empty($this->columns)) {
$this->columns = $this->columns();
}
$this->columns = array_merge($this->columns, $this->actions());
parent::init();
}
示例8: init
public function init()
{
if ($this->sortableColumn) {
array_unshift($this->columns, ['class' => 'twixoff\\sortablegrid\\SortableColumn']);
}
$this->sortableAction = Url::to($this->sortableAction);
parent::init();
}
示例9: init
/**
* Initializes the grid view.
* This method will initialize required property values and instantiate [[columns]] objects.
*/
public function init()
{
$this->dataColumnClass = DataColumn::className();
$this->summaryOptions = ['class' => 'summary well well-sm pull-left margin-bottom-10px'];
$this->layout = '{summary}<div class="clearfix"></div>{pager}{items}{pager}';
$this->showFooter = true;
$this->options = ArrayHelper::merge($this->options, ['class' => 'grid-view table-responsive']);
$this->pager = ['class' => LinkPager::className()];
parent::init();
}
示例10: init
public function init()
{
parent::init();
$this->tableOptions['layoutH'] = $this->layoutH;
$this->layout = "<div id='w_list_print'>{summary}\n{items}\n{pager}</div>";
$this->options['class'] = 'pageContent';
$pagination = new Pagination();
$this->dataProvider->setPagination($pagination);
$this->dataProvider->setSort(new Sort());
}
示例11: init
/**
* @inheritdoc
*/
public function init()
{
if (empty($this->columns)) {
$this->columns = $this->columns();
}
if (!isset($this->columns['actions'])) {
$this->columns['actions'] = ['class' => 'asdfstudio\\admin\\grids\\ActionColumn'];
}
parent::init();
}
示例12: init
public function init()
{
if ($this->modelClass === null) {
$models = $this->dataProvider->getModels();
if (($model = reset($models)) instanceof Model) {
$this->modelClass = $model->classname();
}
}
parent::init();
}
示例13: init
public function init()
{
parent::init();
$this->rowOptions = function ($model, $key, $index, $grid) {
if ($index % 2 === 0) {
return ['class' => 'odd'];
} else {
return ['class' => 'even'];
}
};
}
示例14: init
/**
* @inheritdoc
*/
public function init()
{
if ($this->actions) {
$column = ['class' => 'app\\base\\grid\\ActionColumn', 'header' => 'Actions'];
if (is_array($this->actions)) {
$column['buttons'] = $this->actions;
}
$this->columns[] = $column;
}
parent::init();
$this->initDefaultToolButtons();
}
示例15: init
public function init()
{
parent::init();
if (!isset($this->sortUrl)) {
throw new InvalidConfigException("You must specify the sortUrl");
}
GridViewAsset::register($this->view);
SortableGridViewAsset::register($this->view);
$this->tableOptions['class'] .= ' sortable-grid-view';
$this->rowOptions = function ($model, $key, $index, $grid) {
return ['id' => "items[]_{$model->primaryKey}"];
};
}