Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to write the YII2 framework extension yii2-gird

2025-01-15 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/03 Report--

This article focuses on "how to write the YII2 framework extension yii2-gird", interested friends may wish to take a look. The method introduced in this paper is simple, fast and practical. Let's let the editor take you to learn how to write the YII2 framework extension yii2-gird!

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

For example:

Packaging the form under the bootstrap-panel tag to make it more beautiful; Float Header function, to achieve sliding table, the table field on the top of the screen, easy to view; new operation bar description label; page statistics function; new reset table function; new export table function, including four commonly used formats [html, CSV, txt, Excel].

Install yii2-grid

Using Composer installation, cmd under windows executes the command:

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

Configure yii2-gird

Yii2-gird is a module. The configuration of the module that needs to be added to the configuration file is as follows:

* description:

\ kartik\ gird\ Module configure the path of the girdview module export/download configuration exported Action path details and Demo

Just look at the official documents.

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

Click "Export" to return to the 404 solution

The first time I clicked "Export", I reported an error 404 and couldn't find the interface.

When you click "Export" under analysis, the action completion path is index.php?=module/export/download.

Because my APP is modular, it comes with module, which calls the downloadAction method of the controller ExportController under the module module.

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

What needs to be called is the downloadAction method of the controller ExportController under the module girdview. If the APP is not multi-module, just use the default configuration.

So here you need to copy the ExportController method under the plug-in to the module/Controllers/ directory

Click "Export" again, and a successful pop-up prompt to save the file.

At this point, I believe you have a deeper understanding of "how to write the YII2 framework extension yii2-gird". You might as well do it in practice. Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report