<commit_before>What is DataGridBundle?
-----

datagrid for Symfony2 highly inspired by Zfdatagrid and Magento Grid

planed features:

 - sorting - done
 - paggination - done
 - customizable columns with filters - done
 - mass actions - partially done
 - sources: doctrine(entities) - done , xml, array ... - later
 - exports: xml, excel, pdf ... - later
 - theme support like Symfony\Bridge\Twig\Extension - done but wil be changed a bit

let's call it beta but it's usable

if you want to help or change any part according your needs im open to any idea just create PR or open issue ticket

Compatibility
-----

Symfony2 beta 2

Usage - routes
-----
two routs goes to the same controller action

    grid:
        pattern:  /grid
        defaults: { _controller: YourBundle:Default:grid }

    filter:
        pattern:  /filter
        defaults: { _controller: YourBundle:Default:grid }

Usage - controller
-----

    class DefaultController extends Controller
    {
        public function gridAction()
        {
            /**
             * create simple grid based on your entity.
             * @hint to add custom columns or actions you need to extend Source\Doctrine class
             *
             * 1st param Source object inherited from Source class
             * 2nd param Controller
             * 3th param route to controller action which is handling grid actions (filtering, ordering, pagination ...)
             *           http://en.wikipedia.org/wiki/Post/Redirect/Get to prevent reposting until ajax support is ready
             */
            $grid = new Grid(new Doctrine('YourBundle:YourEntity'), $this, 'filter');
            if ($grid->getReadyForRedirect())
            {
                //data are store do redirect
                return new RedirectResponse($this->generateUrl('grid'));
            }
            else
            {
                //show grid
                return $this->render('YourBundle::default_index.html.twig', array('data' => $grid->prepare()));
            }
        }
    }

Usage - view
-----
view:

    //second parameter is optional and defining template
    {{ grid(data, 'YourBundle::own_grid_theme_template.html.twig') }}

your own grid theme template: you can override blocks - grid, grid_titles, grid_filters, grid_rows, grid_pager, grid_massactions

    //file: YourBundle::own_grid_theme.html.twig
    {% extends 'DataGridBundle::datagrid.html.twig' %}
    {% block grid %}
        extended grid!
    {% endblock %}


Working preview:
<img src="http://vortex-portal.com/datagrid/grid2.png" alt="Screenshot" /><commit_msg>again<commit_after>What is DataGridBundle?
-----

datagrid for Symfony2 highly inspired by Zfdatagrid and Magento Grid

planed features:

 - sorting - done
 - paggination - done
 - customizable columns with filters - done
 - mass actions - partially done
 - sources: doctrine(entities) - done , xml, array ... - later
 - exports: xml, excel, pdf ... - later
 - theme support like Symfony\Bridge\Twig\Extension - done but wil be changed a bit

let's call it beta but it's usable

if you want to help or change any part according your needs im open to any idea just create PR or open issue ticket

Compatibility
-----

Symfony2 beta 2

Usage - routes
-----
two routs goes to the same controller action

    grid:
        pattern:  /grid
        defaults: { _controller: YourBundle:Default:grid }

    filter:
        pattern:  /filter
        defaults: { _controller: YourBundle:Default:grid }

Usage - controller
-----

    class DefaultController extends Controller
    {
        public function gridAction()
        {
            /**
             * create simple grid based on your entity.
             * @hint to add custom columns or actions you need to extend Source\Doctrine class
             *
             * 1st param Source object inherited from Source class
             * 2nd param Controller
             * 3th param route to controller action which is handling grid actions (filtering, ordering, pagination ...)
             *           http://en.wikipedia.org/wiki/Post/Redirect/Get to prevent reposting until ajax support is ready
             */
            $grid = new Grid(new Doctrine('YourBundle:YourEntity'), $this, 'filter');
            if ($grid->getReadyForRedirect())
            {
                //data are store do redirect
                return new RedirectResponse($this->generateUrl('grid'));
            }
            else
            {
                //show grid
                return $this->render('YourBundle::default_index.html.twig', array('data' => $grid->prepare()));
            }
        }
    }

Usage - view
-----
view:

    //second parameter is optional and defining template
    {{ grid(data, 'YourBundle::own_grid_theme_template.html.twig') }}

your own grid theme template: you can override blocks - grid, grid_titles, grid_filters, grid_rows, grid_pager, grid_massactions

    //file: YourBundle::own_grid_theme.html.twig
    {% extends 'DataGridBundle::datagrid.html.twig' %}
    {% block grid %}
        extended grid!
    {% endblock %}


Working preview
-----
<img src="http://vortex-portal.com/datagrid/grid2.png" alt="Screenshot" />
{'fraction_non_alphanumeric': 0.09836065573770492, 'fraction_numerical': 0.002700096432015429, 'mean_word_length': 2.2271313005600497, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 15, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 4}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1384716', 'n_tokens_mistral': 1398, 'n_tokens_neox': 1334, 'n_words': 468}