YII2 framework (iii) Extensions yii2-gird, yii2yii2-gird from scratch

Source: Internet
Author: User

YII2 framework (iii) Extensions yii2-gird, yii2yii2-gird from scratch

The yii2-gird plug-in is an extension of Yii2.0. It provides some practical functions based on the official girdview.

For example:

Wrap the table under the bootstrap-panel label to make it more beautiful. The Float Header function makes it easy to view the table fields at the top of the screen when sliding the table. The operation bar label is added; page statistics function; new table reset function; new table export function, including four common formats: html, CSV, txt, Excel.

Thank you very much for the useful plug-ins provided by the Kartik team. Other plug-ins of the Kartik team are also useful. Trial is recommended.

Install yii2-grid

Use Composer for installation. Run the following command in windows cmd:

$ composer require kartik-v/yii2-grid "*"

Configure yii2-gird

The yii2-gird is a module and the configuration of the module needs to be added to the configuration file is as follows:


* Note:

\ Kartik \ gird \ Module configure the girdview Module path export/download configure the exported Action path for detailed instructions and Demo

Check the official documentation.

Http://demos.krajee.com/grid-demo

Click "Export" to return solution 404

When you click export for the first time, Error 404 cannot be found.

Click "Export" under analysis. The complete action path is index. php? = Module/export/download

Because my APP is modularized, there will be a module that calls the downloadAction method of the controller ExportController under the module.

The export Action path configured above is used here. Note that the default configuration of the plug-in is girdview/export/download.

You need to call the downloadAction method of the controller ExportController under the module girdview. If the APP is not multi-module, use the default configuration directly.

Therefore, copy the ExportController method under the plug-in to the module/Controllers/directory.

Click "Export" again. A window is displayed, prompting you to save the file.




Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.