2017 © Pedro Peláez
 

yii2-extension yii2-ordermodel

Allows users to order records in a grid view via a custom column

image

wubbleyou/yii2-ordermodel

Allows users to order records in a grid view via a custom column

  • Wednesday, January 27, 2016
  • by wubbleyou
  • Repository
  • 1 Watchers
  • 0 Stars
  • 765 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 5 Versions
  • 19 % Grown

The README.md

yii2-ordermodel

Allows users to order records in a grid view via a custom column. This requires 3 minor additions:, (*1)

  • Attach a custom behavior to a ActiveRecord
  • Attach a custom action to a Controller
  • Attach a custom column to a GridView

Installation

Either run, (*2)

php composer.phar require --prefer-dist wubbleyou/yii2-ordermodel "*"

or add, (*3)

"wubbleyou/yii2-ordermodel": "*"

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

Usage

After installing the extension the following is required., (*5)

Adding the custom behavior to a ActiveRecord:, (*6)

    public function behaviors()
    {
        return [
            [
                'class' => OrderBehavior::className(),
                'sortField => 'sort_attribute_name',
                'restrictBy' => ['parent_category_name'] //optional
           ],
        ];
    }

Adding the custom column to a GridView:, (*7)

    public function actions()
    {
        return [
            'order' => array(
                'class' => OrderModelAction::className(),
                'columns' => ['order']
            ),
        ];
    }

Adding the custom column to a GridView, (*8)


GridView::widget([ 'dataProvider' => $dataProvider, 'filterModel' => $searchModel, 'columns' => [ ['class' => 'yii\grid\SerialColumn'], 'id', 'name', [ 'class' => OrderModelColumn::className(), 'attribute' => 'order'], ['class' => 'yii\grid\ActionColumn'], ], ]);

The Versions

27/01 2016

dev-master

9999999-dev

Allows users to order records in a grid view via a custom column

  Sources   Download

BSD-2-Clause

The Requires

 

by Wubbleyou Ltd

extension yii2 gridview

27/01 2016

1.0.3

1.0.3.0

Allows users to order records in a grid view via a custom column

  Sources   Download

BSD-2-Clause

The Requires

 

by Wubbleyou Ltd

extension yii2 gridview

27/01 2016

1.0.2

1.0.2.0

Allows users to order records in a grid view via a custom column

  Sources   Download

BSD-2-Clause

The Requires

 

by Wubbleyou Ltd

extension yii2 gridview

27/01 2016

1.0.1

1.0.1.0

Allows users to order records in a grid view via a custom column

  Sources   Download

BSD-2-Clause

The Requires

 

by Wubbleyou Ltd

extension yii2 gridview

27/01 2016

1.0

1.0.0.0

Allows users to order records in a grid view via a custom column

  Sources   Download

BSD-2-Clause

The Requires

 

by Wubbleyou Ltd

extension yii2 gridview