定制 ericmaicon/yii2-export 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

ericmaicon/yii2-export

Composer 安装命令:

composer require ericmaicon/yii2-export

包简介

Just another yii2 export menu component.

README 文档

README

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

统计信息

  • 总下载量: 81
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 5
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 5
  • Watchers: 1
  • Forks: 10
  • 开发语言: PHP

其他信息

  • 授权协议: BSD-3-Clause
  • 更新时间: 2016-03-16

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固