Download the PHP package mmucklo/grid-bundle without Composer
On this page you can find all versions of the php package mmucklo/grid-bundle. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package grid-bundle
DtcGridBundle
Generate a searchable Grid from a Doctrine ORM Entity or Doctrine MongoDB Document
- Utilize jQuery DataTables, jqGrid(*), or a Styled HTML Table(*)
- Easily styled using Bootstrap
- Customize columns and more...
- (new as of 2.0): Easy to install, easy get started
(*) search functionality supported on DataTables only
Render customizable tables using jqGrid, or jQuery DataTables, or in a Styled HTML Table.
Supports both Doctrine ORM and Doctrine MongoDB ODM
Installation
Symfony 4/5
You may see something like this (please answer 'y' to the question if prompted):
Symfony 2/3
Add this to your AppKernel.php file:
Add this to your app/config/routing.yml file:
Usage
Get Started
After installation, all entities and documents that have a Grid annotation should be available off the dtc_grid route:
(NOTE: symfony5 example below, for symfony2/3, the namespace for the class may be different - e.g. AppBundle instead of App)
There are two recommended ways to setup a grid for a page, through Annotations, or through Reflection
Reflection
Automatic Grid setup is possible by setting the reflections: allowed_entities: [...] parameter in the config/packages/dtc_grid.yaml configuration file (or config.yml for symfony <= 3.4)
(New in 6.0) grid yaml file definition
You can place the grid column definitions in a custom yaml file:
Step 1 - create the yaml file:
Annotation Simple Example
Note: this example still uses reflection to discover the columns, however if you want to customize the columns shown, and even which ones are shown, read on below in the section titled Customize Columns
Now after adding the annotation, you may need to do:
To access the grid:
You can access the grid without embedding it anywhere by going to the following url(s):
- Route: dtc_grid/dtc_grid/grid?class=App:User
- Parameters:
- class=[document_or_entity]
- This can be in either a fully-namespaced class name or symfony-style entity/document format separated by ':'
- e.g. either: 'App:User' or 'App\Entity\User'
- This can be in either a fully-namespaced class name or symfony-style entity/document format separated by ':'
- type=[datatables|table|jq_grid]
- class=[document_or_entity]
Examples:
Note - Security
For production systems you may want to add the path ^/dtc_grid to your security.yml, and make it firewalled / admin-only:
Adding actions
There are presently several actions that you can add to your grid that will appear under a final column called "Actions"
These must be added as annotations to the Grid annotation.
A more custom Route
Changing the renderer
Customize Columns
There's a @Column annotation that lives in Dtc\GridBundle\Annotation that you place on each column you want to be visible. Then you can specify a custom label, and or sortability if you want. If there's no @GridColumn annotations at all, it will default to show all the columns.
Customize jQuery, Purl, DataTables
Customization of the versions of jQuery, Purl, and DataTables can be done in config.yml
JQ Grid
To use JQ Grid, you need to specify the absolute URL, or relative/absolute path to the JQGrid files.
As JQ Grid has a different license than this bundle, there are no defaults provided.
Customize Bootstrap
Multiple Grids on the same page
The RendererFactory needs to be used if you want to render multiple grids on the same page.
There are presently three typs of renderers it supports:
- datatables
- jq_grid
- table
Twig file rendering the multiple grids on the same page
jobs.html.twig:
You can even render multiple types of grids on the same page
jobs.html.twig (a little complicated as styles and javascript has to be included for both grid types, although this isn't necessary if you use the "table" type renderer as it's CSS and Javascript overlaps with the "datatables" renderer):
Customize/Embed Grid
To customize the grid's CSS/Javascript, or embed it into an existing page, follow the example below:
Datatables Twig Example:
JQGrid Twig Example:
Table Twig Example:
Documentation
There is additional (somewhat legacy at this point) documentation stored in Resources/doc/
Legacy:
You used to have to use a "Generator" to create the grid.source service, however this is no longer necessary, however documentation on how to use it is still available in the Resources/doc/ area.
License
This bundle is under the MIT license (see LICENSE file under Resources/meta/LICENSE).
Credit
Originally written by @dtee Maintained by @mmucklo
All versions of grid-bundle with dependencies
symfony/framework-bundle Version 2.*|3.*|4.*|5.*
sensio/framework-extra-bundle Version 2.*|3.*|4.*|5.*|6.*
symfony/templating Version 2.*|3.*|4.*|5.*
symfony/translation Version 2.*|3.*|4.*|5.*
symfony/twig-bundle Version 2.*|3.*|4.*|5.*
twig/twig Version ^1.0||^2.0|^3.0