2017 © Pedro Peláez
 

yii2-extension yii2-contextmenu

yii2 Extended for bootstrap-contextmenu plugin https://github.com/sydcanem/bootstrap-contextmenu

image

liyunfang/yii2-contextmenu

yii2 Extended for bootstrap-contextmenu plugin https://github.com/sydcanem/bootstrap-contextmenu

  • Friday, September 25, 2015
  • by phpyii
  • Repository
  • 4 Watchers
  • 22 Stars
  • 431 Installations
  • PHP
  • 1 Dependents
  • 0 Suggesters
  • 7 Forks
  • 0 Open issues
  • 6 Versions
  • 35 % Grown

The README.md

yii2-contextmenu

yii2 Extended for bootstrap-contextmenu

yii2 Extended for bootstrap-contextmenu plugin https://github.com/sydcanem/bootstrap-contextmenu, (*1)

Gird right - click operation, you can remove the operation column, (*2)

Effect picture 1, (*3)

Effect picture 2, (*4)

Installation

The preferred way to install this extension is through composer., (*5)

Either run, (*6)

 composer require --prefer-dist liyunfang/yii2-contextmenu

or add, (*7)

"liyunfang/yii2-contextmenu": "*"

to the require section of your composer.json file., (*8)

Requirements

This extension require twitter-bootstrap, (*9)

Usage

Once the extension is installed, simply use it in your code by :, (*10)

GridView options ```php 'columns' => [ [ 'class' => \liyunfang\contextmenu\SerialColumn::className(), 'contextMenu' => true, //'contextMenuAttribute' => 'id', 'template' => '{view} {update} , (*11)

  • {story}', 'buttons' => [ 'story' => function ($url, $model) { $title = Yii::t('app', 'Story'); $label = ' ' . $title; $url = \Yii::$app->getUrlManager()->createUrl(['/user/story','id' => $model->id]); $options = ['tabindex' => '-1','title' => $title, 'data' => ['pjax' => '0' , 'toggle' => 'tooltip']]; return '
  • ' . Html::a($label, $url, $options) . '
  • ' . PHP_EOL; } ], ], .... ], 'rowOptions' => function($model, $key, $index, $gird){ $contextMenuId = $gird->columns[0]->contextMenuId; return ['data'=>[ 'toggle' => 'context','target'=> "#".$contextMenuId ]]; },

    ```, (*12)

    or use KartikSerialColumn,But this requires the installation of grid Kartik extension. Please see https://github.com/kartik-v/yii2-grid, (*13)

    GridView options ```php 'columns' => [ [ 'class' => \liyunfang\contextmenu\KartikSerialColumn::className(), 'contextMenu' => true, //'contextMenuAttribute' => 'id', //'template' => '{view} {update}', 'contentOptions'=>['class'=>'kartik-sheet-style'], 'headerOptions'=>['class'=>'kartik-sheet-style'], 'urlCreator' => function($action, $model, $key, $index) { if('update' == $action){ return \Yii::$app->getUrlManager()->createUrl(['/user/index','id' => $model->id]); } if('view' == $action){ return \Yii::$app->getUrlManager()->createUrl(['/user/view','id' => $model->id]); } return '#'; }, ], .... ], 'rowOptions' => function($model, $key, $index, $gird){ $contextMenuId = $gird->columns[0]->contextMenuId; return ['data'=>[ 'toggle' => 'context','target'=> "#".$contextMenuId ]]; },, (*14)

    ```, (*15)

    该扩展为gird行右击菜单,可以省去操作列。 提供了继承yii2 grid的SerialColumn 和 继承 Kartik gird的SerialColumn。, (*16)

    The Versions

    25/09 2015

    dev-master

    9999999-dev https://github.com/liyunfang/yii2-contextmenu

    yii2 Extended for bootstrap-contextmenu plugin https://github.com/sydcanem/bootstrap-contextmenu

      Sources   Download

    MIT

    The Requires

     

    by liyunfang

    extension yii2 contextmenu yii2-contextmenu

    25/09 2015

    1.0.5

    1.0.5.0 https://github.com/liyunfang/yii2-contextmenu

    yii2 Extended for bootstrap-contextmenu plugin https://github.com/sydcanem/bootstrap-contextmenu

      Sources   Download

    MIT

    The Requires

     

    by liyunfang

    extension yii2 contextmenu yii2-contextmenu

    06/09 2015

    1.0.4

    1.0.4.0 https://github.com/liyunfang/yii2-contextmenu

    yii2 Extended for bootstrap-contextmenu plugin https://github.com/sydcanem/bootstrap-contextmenu

      Sources   Download

    MIT

    The Requires

     

    by liyunfang

    extension yii2 contextmenu yii2-contextmenu

    27/08 2015

    1.0.3

    1.0.3.0 https://github.com/liyunfang/yii2-contextmenu

    yii2 Extended for bootstrap-contextmenu plugin https://github.com/sydcanem/bootstrap-contextmenu

      Sources   Download

    MIT

    The Requires

     

    by liyunfang

    extension yii2 contextmenu yii2-contextmenu

    20/08 2015

    1.0.2

    1.0.2.0 https://github.com/liyunfang/yii2-contextmenu

    yii2 Extended for bootstrap-contextmenu plugin https://github.com/sydcanem/bootstrap-contextmenu

      Sources   Download

    MIT

    The Requires

     

    by liyunfang

    extension yii2 contextmenu yii2-contextmenu

    20/08 2015

    1.0.1

    1.0.1.0

    yii2 Extended for bootstrap-contextmenu plugin https://github.com/sydcanem/bootstrap-contextmenu

      Sources   Download

    MIT

    The Requires

     

    by liyunfang

    extension yii2 contextmenu yii2-contextmenu