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

DataGridBundle

by lolozere

sorien/DataGridBundle disappears ! So i create a new repository to maintain it

Getting Started With DataGridBundle

Datagrid for Symfony2 inspired by Zfdatagrid and Magento Grid but not compatible.

Compatibility: Symfony 2.x

The following documents are available:

  1. Installation
  2. Grid Configuration
  3. Annotations
  4. Multiple grids
  5. Overriding Templates

Special thanks to all contributors

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

Simple grid with ORM or ODM as source

// MyProject\MyBundle\DefaultController.php
namespace MyProject\MyBundle\Controller;

use Symfony\Component\HttpFoundation\RedirectResponse;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;

use Sorien\DataGridBundle\Grid\Source\Entity;
use Sorien\DataGridBundle\Grid\Source\Document;

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

        // or use Document source class for ODM
        $source = new Document('MyProjectMyBundle:MyDocument');

        $grid = $this->get('grid');

        // Mass actions, query and row manipulations are defined here

        $grid->setSource($source);

        // Columns, row actions are defined here

        if ($grid->isReadyForRedirect())
        {
            // Data are stored, do redirect to prevent multiple post requests
            return new RedirectResponse($grid->getRouteUrl());
        }
        else
        {
            // To obtain data for template simply pass in the grid instance
            return $this->render('MyProjectMyBundle::my_grid.html.twig', array('data' => $grid));
        }
    }
}

Rendering inside twig

<!-- MyProject\MyBundle\Resources\views\my_grid.html.twig -->
{{ grid(data) }}

Working preview with assets

Copyright (c) 2011 Stanislav Turza

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.
  • Merge pull request #84 from morferic/patch-1
    By Abhoryo, 1 year ago
  • Merge pull request #84 from morferic/patch-1
    By Abhoryo, 1 year ago
  • Merge pull request #84 from morferic/patch-1
    By Abhoryo, 1 year ago
  • Merge pull request #84 from morferic/patch-1
    By Abhoryo, 1 year ago
  • Merge pull request #84 from morferic/patch-1
    By Abhoryo, 1 year ago
  • Merge pull request #84 from morferic/patch-1
    By Abhoryo, 1 year ago
  • Merge pull request #84 from morferic/patch-1
    By Abhoryo, 1 year ago
  • Merge pull request #84 from morferic/patch-1
    By Abhoryo, 1 year ago
  • Merge pull request #84 from morferic/patch-1
    By Abhoryo, 1 year ago
  • Merge pull request #84 from morferic/patch-1
    By Abhoryo, 1 year ago
  • Merge pull request #84 from morferic/patch-1
    By Abhoryo, 1 year ago
  • Merge pull request #84 from morferic/patch-1
    By Abhoryo, 1 year ago
  • Merge pull request #84 from morferic/patch-1
    By Abhoryo, 1 year ago
  • Merge pull request #84 from morferic/patch-1
    By Abhoryo, 1 year ago
  • Merge pull request #84 from morferic/patch-1
    By Abhoryo, 1 year ago
  • Merge pull request #84 from morferic/patch-1
    By Abhoryo, 1 year ago
  • Merge pull request #84 from morferic/patch-1
    By Abhoryo, 1 year ago
  • Merge pull request #84 from morferic/patch-1
    By Abhoryo, 1 year ago
  • Merge pull request #84 from morferic/patch-1
    By Abhoryo, 1 year ago
  • Merge pull request #84 from morferic/patch-1
    By Abhoryo, 1 year ago
  • Merge pull request #84 from morferic/patch-1
    By Abhoryo, 1 year ago
  • Merge pull request #84 from morferic/patch-1
    By Abhoryo, 1 year ago
  • Merge pull request #84 from morferic/patch-1
    By Abhoryo, 1 year ago
  • Merge pull request #84 from morferic/patch-1
    By Abhoryo, 1 year ago
  • Merge pull request #84 from morferic/patch-1
    By Abhoryo, 1 year ago
  • Merge pull request #84 from morferic/patch-1
    By Abhoryo, 1 year ago
  • Merge pull request #84 from morferic/patch-1
    By Abhoryo, 1 year ago
  • Merge pull request #84 from morferic/patch-1
    By Abhoryo, 1 year ago
  • Merge pull request #84 from morferic/patch-1
    By Abhoryo, 1 year ago
  • Merge pull request #84 from morferic/patch-1
    By Abhoryo, 1 year ago