wubbleyou/yii2-ordermodel 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

wubbleyou/yii2-ordermodel

最新稳定版本:1.0.3

Composer 安装命令:

composer require wubbleyou/yii2-ordermodel

包简介

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

README 文档

README

Allows users to order records in a grid view via a custom column. This requires 3 minor additions:

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

Installation

Either run

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

or add

"wubbleyou/yii2-ordermodel": "*"

to the require section of your composer.json file.

Usage

After installing the extension the following is required.

Adding the custom behavior to a ActiveRecord:

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

Adding the custom column to a GridView:

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

Adding the custom column to a GridView


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

统计信息

  • 总下载量: 11.49k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 1
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: BSD-2-Clause
  • 更新时间: 2016-01-27

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固