Code Monkey home page Code Monkey logo

yii2-export's Introduction

yii2-export

Stable Version Unstable Version License Total Downloads Monthly Downloads Daily Downloads

A library to export server/db data in various formats (e.g. excel, html, pdf, csv etc.) using the PHPExcel 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.

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:

  • 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.

  • exportFormView allows you to setup your own custom view file for rendering the export form.
  • exportColumnsView allows you to setup your own custom view file for rendering the column selector dropdown.

Demo

You can see detailed documentation and demonstration on usage of the extension.

Latest Release

NOTE: The latest version of the extension is v1.2.7. Refer the CHANGE LOG for details.

Installation

The preferred way to install this extension is through composer.

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

Either run

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

or add

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

to the require section of your composer.json file.

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
]);

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

License

yii2-export is released under the BSD 3-Clause License. See the bundled LICENSE.md for details.

yii2-export's People

Contributors

kartik-v avatar fsateler avatar edofre avatar fallingdust avatar friek108 avatar deividas1 avatar gorbachevpavel avatar aayaresko avatar stivehu avatar ksideks avatar romeromsk avatar ananthhh avatar arnaud-g1 avatar antoninslejska avatar ieshmelev avatar jussiaho avatar lukascernydis avatar richweber avatar tibee avatar tphan-tx avatar bmsrox avatar karneds avatar muhammadcahya avatar tonisormisson avatar

Watchers

杜鹏 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.