ericmaicon/yii2-export Just another yii2 export menu component.

extensionexport

Just another Yii2 Export Widget for Yii2

Latest Version Build Status

The main purpose of this library is not replace kartik-v/yii2-export. Kartik's one has a lot of features not implemented on this one.

This is a new yii2-export widget wrote from the scratch to improve performance.

The idea of this one appeared when PHPExcel doesn't fit to generate large excel files in a fast way. The first feature was dispatch reports to be generated in queues.

Not enough, another feature was replace PHPExcel with spout, successfully reducing the time consuming.

Installation

The preferred way to install this extension is through composer.

Either run

$ composer require ericmaicon/yii2-export:*

or add

"ericmaicon/yii2-export": "*"

to the require section of your composer.json file.

Usage

Using with the Grid:

<?= \Da\export\GridView::widget([
    'dataProvider' => $dataProvider,
]); ?>

To use Kartik's grid you will need to override renderExport method:

<?php

use Da\export\ExportMenu;

class GridView extends \kartik\grid\GridView
{
    public function renderExport()
    {
        return ExportMenu::widget([
            'dataProvider' => $this->dataProvider,
            'columns' => $this->columns,
        ]);
    }
}

Stand-alone use:

Another configurations:

Queue

[
    'target' => \Da\export\ExportMenu::TARGET_QUEUE,
    'queueConfig' => [
        'queueName' => \common\models\ReportModel::REPORT_TUBE,
        'queueAdapter' => \Da\export\queue\rabbitmq\RabbitMqQueueStoreAdapter::className(),
        'queueMessage' => function () {

        }
    ]
]

Target

[
    'target' => \Da\export\ExportMenu::TARGET_SELF,
]

Filename

[
    'filename' => 'test',
]

Export Footer

[
    'exportFooter' => true,
]

Options

[
    'class' => 'btn-group',
]

Dropdown Options

[
    'class' => 'btn btn-default',
    'label' => 'Export',
    'menuOptions' => [
        'class' => 'dropdown-menu dropdown-menu-right'
    ]
]

Dropdown Items

[
    ExportMenu::FORMAT_CSV => [
        'label' => 'CSV',
        'options' => [
            'title' => 'Comma Separated Values',
            'data-id' => ExportMenu::FORMAT_CSV,
        ],
        'url' => 'javascript:;',
        'className' => CsvOption::className(),
    ]
]

Selected Option

[
    'selectedOption' => ExportMenu::FORMAT_CSV,
]

Testing

$ ./vendor/bin/phpunit

What is missing?

  1. PDF, HTML and TXT export options
  2. Confirm Alert
  3. Column selectors
  4. Store file
  5. Events
  6. Internationalization

Statistics

Downloads
GitHub Stars
GitHub Forks

Releases

  • 1.016 March 2016

Comments



1.0 is the latest of one release



BSD-3-Clause license
Stats
5 github stars & 11 github forks
0 downloads in the last day
0 downloads in the last 30 days
81 total downloads