2017 © Pedro Peláez
 

yii2-extension yii2-export

A library to export server/db data in various formats (e.g. excel, html, pdf, csv etc.)

image

kartik-v/yii2-export

A library to export server/db data in various formats (e.g. excel, html, pdf, csv etc.)

  • Thursday, July 12, 2018
  • by kartik-v
  • Repository
  • 14 Watchers
  • 118 Stars
  • 348,924 Installations
  • PHP
  • 42 Dependents
  • 0 Suggesters
  • 87 Forks
  • 43 Open issues
  • 13 Versions
  • 9 % Grown

The README.md

Krajee Logo
yii2-export
Donate       kartikv

[![Stable Version](https://poser.pugx.org/kartik-v/yii2-export/v/stable)](https://packagist.org/packages/kartik-v/yii2-export) [![Unstable Version](https://poser.pugx.org/kartik-v/yii2-export/v/unstable)](https://packagist.org/packages/kartik-v/yii2-export) [![License](https://poser.pugx.org/kartik-v/yii2-export/license)](https://packagist.org/packages/kartik-v/yii2-export) [![Total Downloads](https://poser.pugx.org/kartik-v/yii2-export/downloads)](https://packagist.org/packages/kartik-v/yii2-export) [![Monthly Downloads](https://poser.pugx.org/kartik-v/yii2-export/d/monthly)](https://packagist.org/packages/kartik-v/yii2-export) [![Daily Downloads](https://poser.pugx.org/kartik-v/yii2-export/d/daily)](https://packagist.org/packages/kartik-v/yii2-export)

A library to export server/db data in various formats (e.g. excel, html, pdf, csv etc.) using the PhpSpreadsheet library. The widget allows you to configure the dataProvider, columns just like a yii\grid\GridView. However, it just displays the export actions in form of a ButtonDropdown menu, for embedding into any of your GridView or other components., (*1)

In addition, with release v1.2.0, the extension also displays a handy grid columns selector for controlling the columns for export. The features available with the column selector are:, (*2)

  • shows a column picker dropdown list to allow selection of columns for export.
  • new container property allows you to group the export menu and column selector dropdowns.
  • new template property for manipulating the display of menu, column selector or additional buttons in button group.
  • allows configuration of column picker dropdown button through columnSelectorOptions
  • auto-generates column labels in the column selector. But you can override displayed column labels for each column key through columnSelector property settings.
  • allows preselected columns through selectedColumns (you must set the selected column keys)
  • allows columns to be disabled in column selector through disabledColumns (you must set the disabled column keys)
  • allows columns to be hidden in column selector through hiddenColumns (you must set the hidden column keys)
  • allows columns to be hidden from both export and column selector through noExportColumns (you must set the no export column keys)
  • toggle display of the column selector through showColumnSelector property
  • column selector is displayed only if asDropdown is set to true.

The extension offers configurable user interfaces for advanced cases using view templates., (*3)

  • exportColumnsView allows you to setup your own custom view file for rendering the column selector dropdown.
  • afterSaveView allows you to setup your own after save view file if you are configuring to save exported file on server.

Demo

You can see detailed documentation and demonstration on usage of the extension., (*4)

Release Changes

NOTE: Refer the CHANGE LOG for details on changes to various releases., (*5)

Installation

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

Note: Read this web tip /wiki on setting the minimum-stability settings for your application's composer.json., (*7)

Pre-requisites

Install the necessary pre-requisite (Krajee Dropdown Extension) based on your bootstrap version:, (*8)

  • For Bootstrap v5.x install the extension kartik-v/yii2-bootstrap5-dropdown
  • For Bootstrap v4.x install the extension kartik-v/yii2-bootstrap4-dropdown
  • For Bootstrap v3.x install the extension kartik-v/yii2-dropdown-x

For example if you are using the Bootstrap v5.x add the following to the require section of your composer.json file:, (*9)

"kartik-v/yii2-bootstrap5-dropdown": "@dev"

Install

Either run:, (*10)

$ php composer.phar require kartik-v/yii2-export "@dev"

or add, (*11)

"kartik-v/yii2-export": "@dev"

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

Note: you must run composer update to have the latest stable dependencies like kartik-v/yii2-krajee-base, (*13)

Pre-requisites

The yii2-export extension is dependent on yii2-grid extension module. In order to start using yii2-export, you need to ensure setup of the gridview module in your application modules configuration file. For example:, (*14)

'modules' => [
    'gridview' => [
        'class' => 'kartik\grid\Module',
        // other module settings
    ]
]

Usage

ExportMenu

use kartik\export\ExportMenu;
$gridColumns = [
    ['class' => 'yii\grid\SerialColumn'],
    'id',
    'name',
    'color',
    'publish_date',
    'status',
    ['class' => 'yii\grid\ActionColumn'],
];

// Renders a export dropdown menu
echo ExportMenu::widget([
    'dataProvider' => $dataProvider,
    'columns' => $gridColumns,
    'clearBuffers' => true, //optional
]);

// You can choose to render your own GridView separately
echo \kartik\grid\GridView::widget([
    'dataProvider' => $dataProvider,
    'filterModel' => $searchModel,
    'columns' => $gridColumns
]);

Contributors

Code Contributors

This project exists thanks to all the people who contribute. [Contribute]. , (*15)

Financial Contributors

Become a financial contributor and help us sustain our community. [Contribute], (*16)

Individuals

, (*17)

Organizations

Support this project with your organization. Your logo will show up here with a link to your website. [Contribute], (*18)

, (*19)

License

yii2-export is released under the BSD-3-Clause License. See the bundled LICENSE.md for details., (*20)

The Versions

12/07 2018

dev-master

9999999-dev https://github.com/kartik-v/yii2-export

A library to export server/db data in various formats (e.g. excel, html, pdf, csv etc.)

  Sources   Download

BSD-3-Clause

The Requires

 

csv extension json yii2 xls html widget export text pdf spreadsheet xlsx openxml

24/02 2018

v1.2.9

1.2.9.0 https://github.com/kartik-v/yii2-export

A library to export server/db data in various formats (e.g. excel, html, pdf, csv etc.)

  Sources   Download

BSD-3-Clause

The Requires

 

csv extension json yii2 xls html widget export text pdf spreadsheet xlsx openxml

19/11 2017

v1.2.8

1.2.8.0 https://github.com/kartik-v/yii2-export

A library to export server/db data in various formats (e.g. excel, html, pdf, csv etc.)

  Sources   Download

BSD-3-Clause

The Requires

 

csv extension json yii2 xls html widget export text pdf spreadsheet xlsx openxml

13/03 2017

v1.2.7

1.2.7.0 https://github.com/kartik-v/yii2-export

A library to export server/db data in various formats (e.g. excel, html, pdf, csv etc.)

  Sources   Download

BSD-3-Clause

The Requires

 

csv extension json yii2 xls html widget export text pdf spreadsheet xlsx openxml

05/08 2016

v1.2.6

1.2.6.0 https://github.com/kartik-v/yii2-export

A library to export server/db data in various formats (e.g. excel, html, pdf, csv etc.)

  Sources   Download

BSD-3-Clause

The Requires

 

csv extension json yii2 xls html widget export text pdf spreadsheet xlsx openxml

18/04 2016

v1.2.5

1.2.5.0 https://github.com/kartik-v/yii2-export

A library to export server/db data in various formats (e.g. excel, html, pdf, csv etc.)

  Sources   Download

BSD-3-Clause

The Requires

 

csv extension json yii2 xls html widget export text pdf spreadsheet xlsx openxml

04/02 2016

v1.2.4

1.2.4.0 https://github.com/kartik-v/yii2-export

A library to export server/db data in various formats (e.g. excel, html, pdf, csv etc.)

  Sources   Download

BSD-3-Clause

The Requires

 

csv extension json yii2 xls html widget export text pdf spreadsheet xlsx openxml

19/07 2015

v1.2.3

1.2.3.0 https://github.com/kartik-v/yii2-export

A library to export server/db data in various formats (e.g. excel, html, pdf, csv etc.)

  Sources   Download

BSD-3-Clause

The Requires

 

csv extension json yii2 xls html widget export text pdf spreadsheet xlsx openxml

14/02 2015

v1.2.2

1.2.2.0 https://github.com/kartik-v/yii2-export

A library to export server/db data in various formats (e.g. excel, html, pdf, csv etc.)

  Sources   Download

BSD 3-Clause

The Requires

 

csv extension json yii2 xls html widget export text pdf spreadsheet xlsx openxml

27/01 2015

v1.2.1

1.2.1.0 https://github.com/kartik-v/yii2-export

A library to export server/db data in various formats (e.g. excel, html, pdf, csv etc.)

  Sources   Download

BSD 3-Clause

The Requires

 

extension yii2 xls widget export spreadsheet xlsx openxml

12/01 2015

v1.2.0

1.2.0.0 https://github.com/kartik-v/yii2-export

A library to export server/db data in various formats (e.g. excel, html, pdf, csv etc.)

  Sources   Download

BSD 3-Clause

The Requires

 

extension yii2 xls widget export spreadsheet xlsx openxml

26/12 2014

v1.1.0

1.1.0.0 https://github.com/kartik-v/yii2-export

A library to export server/db data in various formats (e.g. excel, html, pdf, csv etc.)

  Sources   Download

BSD 3-Clause

The Requires

 

extension yii2 xls widget export spreadsheet xlsx openxml

23/12 2014

v1.0.0

1.0.0.0 https://github.com/kartik-v/yii2-export

A library to export server/db data in various formats (e.g. excel, html, pdf, csv etc.)

  Sources   Download

BSD 3-Clause

The Requires

 

extension yii2 xls widget export spreadsheet xlsx openxml