Developed with love by KnpLabs Hire us for your project!
379

APYDataGridBundle

by Abhoryo

Symfony2 Datagrid Bundle (Sorien DataGridBundle 2.0)

Datagrid for Symfony2 inspired by Zfdatagrid and Magento Grid.

This bundle was initiated by Stanislav Turza (Sorien).

Version: 2.1-dev - master-dev
Compatibility: Symfony >= 2.0.0, Twig >= 1.5.0

Build Status

See CHANGELOG and UPGRADE 2.0

Features

  • Supports Entity (ORM), Document (ODM) and Vector (Array) sources
  • Sortable and Filterable with operators (Comparison operators, range, starts/ends with, (not) contains, is (not) defined, regex)
  • Auto-typing columns (Text, Number, Boolean, Array, DateTime, Date, ...)
  • Locale support for DateTime, Date and Number columns (Decimal, Currency, Percent, Duration, Scientific, Spell out)
  • Input, Select, checkbox and radio button filters filled with the data of the grid or an array of values
  • Export (CSV, Excel, PDF, XML, JSON, HTML, ...)
  • Mass actions
  • Row actions
  • Supports mapped fields with Entity source
  • Securing the columns, actions and export with security roles
  • Annotations and PHP configuration
  • External filters box
  • Ajax loading
  • Pagination (You can also use Pagerfanta)
  • Column width and column align
  • Prefix translated titles
  • Grid manager for multi-grid on the same page
  • Groups configuration for ORM and ODM sources
  • Easy templates overriding (twig)
  • Custom columns and filters creation
  • ...

Documentation

See the summary.

Screenshot

Full example with this CSS style file:

test

Simple example with the external filter box in english:

test

Same example in french:

test

Data used in these screenshots (this is a phpMyAdmin screenshot):

test

Simple grid with an ORM source

<?php
namespace MyProject\MyBundle\Controller;

use APY\DataGridBundle\Grid\Source\Entity;

class DefaultController extends Controller
{
    public function myGridAction()
    {
        // Creates a simple grid based on your entity (ORM)
        $source = new Entity('MyProjectMyBundle:MyEntity');

        // Get a Grid instance
        $grid = $this->get('grid');

        // Attach the source to the grid
        $grid->setSource($source);

        // Return the response of the grid to the template
        return $grid->getGridResponse('MyProjectMyBundle::myGrid.html.twig');
    }
}

Simple configuration of the grid in the entity

<?php
namespace MyProject\MyBundle\Entity

use Doctrine\ORM\Mapping as ORM;
use APY\DataGridBundle\Grid\Mapping as GRID;

/**
 * @GRID\Source(columns="id, my_datetime")
 */
class MyEntity
{
    /*
     * @ORM\Column(type="integer")
     */
    protected $id;

    /*
     * @ORM\Column(type="datetime")
     */
    protected $my_datetime;
}

Display the grid in a twig template

<?php
<!-- MyProject\MyBundle\Resources\views\myGrid.html.twig -->

{{ grid(grid) }}

And clear your cache.

Special thanks to all contributors

Abhoryo, golovanov, touchdesign, Spea, nurikabe, print, Gregory McLean, centove, lstrojny, Benedikt Wolters, Martin Parsiegla, evan and all bug reporters

Todo list

See this Pull Request

Copyright (c) 2011-2014 Stanislav Turza - Abhoryo

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is furnished
to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
apy_data_grid:
limits:

# Defaults:
20: 20
50: 50
100: 100
persistence: false
theme: APYDataGridBundle::blocks.html.twig
no_data_message: No data
no_result_message: No result
actions_columns_size: -1
actions_columns_title: Actions
actions_columns_separator: <br />
pagerfanta:
enable: false
view_class: Pagerfanta\View\DefaultView
options:

# Prototype
options: []
  • Merge pull request #716 from plfort/mass-action-id-session
    By Abhoryo, 1 year ago
  • Revert "Merge pull request #449 from acseo/master"
    By PETIT Yoann, 1 year ago
  • Merge pull request #449 from acseo/master
    By Abhoryo, 1 year ago
  • Add MassActionColumn::ID in keys to be remove from session in getFilters
    By plfort, 1 year ago
  • Merge pull request #712 from b-durand/patch-1
    By Abhoryo, 1 year ago
  • Merge pull request #704 from TomasVotruba/patch-1
    By Abhoryo, 1 year ago
  • Fix wrong default junction for eq and select multi
    By , 1 year ago
  • Doc: installation - composer is standard nowadays
    By TomasVotruba, 1 year ago
  • remove tabs in doc
    By npotier, 1 year ago
  • Merge remote-tracking branch 'upstream/master'
    By npotier, 1 year ago
  • Merge pull request #699 from TomasVotruba/patch-1
    By Abhoryo, 1 year ago
  • travis: PHP 7.0 nightly added
    By TomasVotruba, 1 year ago
  • Merge pull request #696 from phpetra/patch-1
    By Abhoryo, 1 year ago
  • Update messages.nl.xliff
    By , 1 year ago
  • Merge pull request #680 from plfort/filter-case-insensitive
    By Abhoryo, 1 year ago
  • Make LIKE operator case insensitive by default
    By , 1 year ago
  • Add ILIKE, NILIKE, LILIKE, RILIKE operators (case insensitive search)
    By plfort, 1 year ago
  • Merge pull request #685 from meron1122/master
    By Abhoryo, 1 year ago
  • Merge pull request #684 from krzysiekpiasecki/patch-1
    By Abhoryo, 1 year ago
  • Merge pull request #678 from plfort/grid_getfilters
    By Abhoryo, 1 year ago
  • Merge pull request #1 from meron1122/meron1122-polish-translate-update
    By meron1122, 1 year ago
  • Polsih translate update
    By meron1122, 1 year ago
  • Update set_columns_order.md
    By , 1 year ago
  • Forgotten field member $sessionFilters ...
    By plfort, 2 years ago
  • Enable filter access in manipulateQuery :
    By plfort, 2 years ago
  • Update create_filter.md
    By Abhoryo, 2 years ago
  • Merge pull request #656 from plfort/master
    By Abhoryo, 2 years ago
  • rename useGridPefix to usePrefixTitle
    By plfort, 2 years ago
  • generate exception if no metadata found from all drivers
    By Dexter Morgan, 2 years ago
  • generate exception if no metadata found from all drivers
    By Dexter Morgan, 2 years ago