schmasterz/yii2-widget-ag-grid

Yii2 wrapper for ag-grid.

1.0 2019-04-18 19:19 UTC

This package is auto-updated.

Last update: 2024-04-12 04:25:01 UTC


README

This extension provides the agGrid integration for the Yii2 framework.

Requirements

The minimum requirement by yii2-widget-ag-grid that your Web server supports PHP 7.1.

Install via Composer

If you do not have Composer, you may install it by following the instructions at getcomposer.org.

Run

$ php composer.phar require schmasterz/yii2-widget-ag-grid "master@dev"

Usage

<?= \schmasterz\agGrid\AgGridWidget::widget([
        'id' => 'ag-grid',
        'options' => [
            'style' => 'height: 600px;width:500px;'
        ],
        'gridOptions' => [
            'columnDefs' => [
                ['headerName' => 'Make', 'field' => 'make', 'sortable' => true],
                ['headerName' => 'Model', 'field' => 'model', 'sortable' => true],
                ['headerName' => 'Price', 'field' => 'price', 'sortable' => true],
            ],
            
        ]
     ]);
?>

You can also use agGrid in the JavaScript layer of your application. To achieve this, you need to include agGrid as a dependency of your Asset file

public $depends = [
    'schmasterz\agGrid\AgGridAsset',
];

or add it to your view file

schmasterz\agGrid\AgGridAsset::register($this);