Coder Social home page Coder Social logo

yii2-export's Introduction

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

yii2-export's People

Contributors

ericmaicon avatar onmotion avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.