定制 prezent/grid 二次开发

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

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

prezent/grid

Composer 安装命令:

composer require prezent/grid

包简介

Generic data grids and lists

README 文档

README

Build Status

A framework-independent library for building and rendering generic datagrids in PHP.

Installation

This extension can be installed using Composer. Tell composer to install the extension:

$ php composer.phar require prezent/grid

Symfony users should use the prezent/grid-bundle. This sets up everything automatically and adds extra features such as router and translation integration.

Quick example

If you have any experience using Symfony Forms, then this grid library will feel very familiar. Start by defining a grid:

<?php

namespace My\Grids;

use Prezent\Grid\BaseGridType;
use Prezent\Grid\Extension\Core\Type\DateTimeType;
use Prezent\Grid\Extension\Core\Type\StringType;
use Prezent\Grid\GridBuilder;

class MyGridType extends BaseGridType
{
    public function buildGrid(GridBuilder $builder, array $options = [])
    {
        $builder
            ->addColumn('id', StringType::class, [
                'label' => 'ID',
                'url'   => '/view/{id}',
            ])
            ->addColumn('name', StringType::class)
            ->addColumn('created', DateTimeType::class, ['pattern' => 'yyyy qqq'])
            ->addAction('edit', ['url' => '/edit/{id}'])
        ;
    }
}

In your controller, create the grid and assign it to your view:

<?php

namespace My\Controllers;

use My\Grids\MyGridType;

class MyController
{
    public function indexAction()
    {
        $data = $this->db->findSomeData();
        $grid = $this->getService('grid_factory')->createGrid(MyGridType::class);

        $this->view->data = $data;
        $this->view->grid = $grid->createView();
    }
}

Finally, render the grid using Twig:

{{ grid(grid, data) }}

Documentation

The complete documentation can be found in the doc directory.

统计信息

  • 总下载量: 27.11k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 13
  • 点击次数: 2
  • 依赖项目数: 1
  • 推荐数: 0

GitHub 信息

  • Stars: 13
  • Watchers: 8
  • Forks: 4
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2015-08-10

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固