2017 © Pedro Peláez
 

yii2-extension yii2-utils

A set of common used yii2 tools

image

stupant/yii2-utils

A set of common used yii2 tools

  • Monday, September 5, 2016
  • by dinhtrung
  • Repository
  • 1 Watchers
  • 0 Stars
  • 22 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 1 Versions
  • 47 % Grown

The README.md

yii2-utils

Yii2 common utils is a set of common used tools for Yii2 framework., (*1)

  • stupant\utils\PTotal: Display totals for column footer in Gridview.
  • stupant\utils\BigDataActiveDataProvider: Gradually select data for big tables.
  • stupant\utils\GridView: Plain GridView table generate without any JS.

Usage

PTotal

Display the total of a numeric data column., (*2)

<?= GridView::widget([
    'dataProvider' => $dataProvider,
    'showFooter' => true,
    'footerRowOptions' => ['class' => 'text text-success bg-success'],
    'columns' => [
      ...
      [
        'attribute' => 'cnt',
        'label' => Yii::t('app', 'Count'),
        'format' => 'integer',
        'footer' => Yii::$app->formatter->format(stupant\utils\PTotal::pageTotal($dataProvider->models, 'cnt'), 'integer')
      ],
      ...
    ],
]); ?>

GridView

Show a GridView without any assets bundle. Best for display data without pagination situation (export data / email templates...), (*3)

= stupant\utils\GridView::widget([
    'dataProvider' => $dataProvider,
]); ?>

BigDataActiveDataProvider

Only retrieve more records if required. Suitable for big data tables., (*4)

$dataProvider = new BigDataActiveDataProvider([
  'query' => ActiveRecord::find()
]);

The Versions

05/09 2016

dev-master

9999999-dev

A set of common used yii2 tools

  Sources   Download

MIT

The Requires

 

by Trung Nguyen

yii2 utils