apy / apydatagridbundle Goto Github PK
View Code? Open in Web Editor NEWSymfony Datagrid Bundle
License: MIT License
Symfony Datagrid Bundle
License: MIT License
Can we use filters in a block next to the grid not ine each column ?
Implementation of the controller to delete rows directly in DataGridBundle.
And we just have to add this action;
$actions->addDeleteAction();
like suggested by Abhoryo
change translations to xml format compatible with symfony
add languages
Hi,
i have a short feature request.
I think its a good idea to bring in a method for extra params that will append to the generated routes.
A short example:
// controller
$grid->addExtraParams(array('x' => 1));
// Grid.php
public function getRouteUrl()
$this->router->generate($this->request->get('_route'), $this->getExtraParams());
So we can add some extra params to the routes, i think it's a nice feature.
Weird issue. I am creating a grid as follows:
$grid = $this->get('grid');
$grid->addMassAction(new DeleteMassAction());
$grid->setSource(new Entity('MyCandidateBundle:Candidate'));
$grid->addRowAction(new RowAction('Show', 'candidate_show'));
$grid->addRowAction(new RowAction('Edit', 'candidate_edit'));
Works fine, yet it creates two checkboxes to the left of each row.
When using groupBy in the query, the method Entity#getTotalCount fails with a "NonUniqueResultException".
Example:
<?php
$source->setCallback(Source::EVENT_PREPARE_QUERY, function($qb) {
$qb->groupBy(Entity::TABLE_ALIAS .'.id');
});
I think the grid shouldn't call another route to filter data.
Could we just add a query parameter to tell that the grid must is filtered ?
Or look at the grid hash in the query string of the url or in the session ? ( If the hash of the grid exist with the primary column, the grid is filtered. )
What do you think ?
Hello,
I've gor an error on line 23:
You should replace g with G in datagrid
from
$definition = new Definition('Sorien\DatagridBundle\Extension\DataGrid');
to
$definition = new Definition('Sorien\DataGridBundle\Extension\DataGrid');
Thks
Pascal
Hi,
i search for the right way to bring in some extra columns into my grid.
My first example is a simple image column, like "src/folder/{{ row.id }}.jpg".
I am not sure what's the right way for this, i hope anyone can get me a short tipp?
My second problem are columns with a ManyToOne situation:
* @GRID\Source(columns="id, name, category")
*/
class MyClass
{
....
* @GRID\Column(id="category.name", title="category", field="category")
*/
protected $category;
But my column category does not work/display in my grid with this configuration.
I hope anyone can help?
Thanks!
The pager disappears when you choose a limit greater than the number of results.
After this change, we can no longer set another limit.
(limit = items per page)
The documentation is clear on how to use the DataGrid bundle with Twig. Does it work with PHP as the template engine? Is something like this possible?
<?php
$source = new Entity('AcmeDemoBundle:MyEntity');
$grid = $this->get('grid');
$grid->setSource($source);
// ...
<?php echo $grid->renderHtml() ?>
I think it's better to define for each new grid a unique Id.
With these auto generated Id we don't have to define our own id for each grid when we use multiple grids on the same page.
It'll be easier to use, don't you think?
actions are not selecting checkboxes
it will require a bit of javascript. i would like to have pure js implementation without dependency to any ja framework
Receiving the above error when trying to render ManyToOne columns.. For example in my UserBundle:
/**
* @ORM\ManyToOne(targetEntity="MyApp\CompanyBundle\Entity\Company")
* @ORM\JoinColumn(name="company_id", referencedColumnName="id")
* @Grid\Column(id="company.name", title="Current Employer", filterable=true, visible=true)
*/
protected $company;
Could this be because I am joining across bundles (UserBundle -> CompanyBundle)?
After update twig ans symfony, the datagrid bundle stopped working. It display the message:
An exception has been thrown during the rendering of a template ("[Syntax Error] line 0, col 77: Error: Expected =, <, <=, <>, >, >=, !=, got '('") in "GestorSistemaBundle:Country:index.html.twig" at line 1.
There is only one line on my template:
{{ grid(data) }}
The template don't extends any other template.
Hi!
i have tested youre grid in my app and its a wonderfull bundle, but i have problems with multiple grids on the same page and i doesent know what's wrong.
$grid = $this->get('grid');
// First Grid
$grid->setId('grid1');
$source = new Entity(OneEntity);
$grid->setSource($source);
// And now the second:
$grid->setId('grid2');
$source = new Entity(SecondEntity);
$grid->setSource($source);
Error: Source can be set just once
I'm not sure if I understood this function correctly?
I hope you can get me a short tip.
Thanks for your time.
row class is prepared for this 2 features just its not implemented in twig template
In the grid_titles block, if you set sortable=false to a column, his title will not be translated.
See how we can integrate another pager like pagerFanta used by many Bundles.
Perhaps a twig extension. I see what i can do.
block inheritance in twig has changed in stable version ... it was partially fixed but you can extend template just once (one level) ... this need proper fix for multiple levels
we could create grid configuration in base config like
datagrid:
template: YourBaseTemplate
or
datagrid:
grids:
mygrid:
id: 'foo'
limits: {20: '20', 100:'100', 0:'all'}
source: {type: 'entity', name:'Blog::Pages'}
and in controller you can call just this->get('grid.mygrid') and you will get grid with all settings
Hi,
is search for a way to enable or disable a row action based on a column value, for example:
column: isfresh = 1 -> allow UpdateAction for this row in grid
column: isfresh = 0 -> disallow/hide UpdateAction for this row in grid
What's the right way for this szenario?
I hope anyone can help, thanks and a nice weekend.
From:
use Sorien\DataGridBundle\Source\Entity;
use Sorien\DataGridBundle\Source\Document;
To:
use Sorien\DataGridBundle\Grid\Source\Entity;
use Sorien\DataGridBundle\Grid\Source\Document;
Can you provide yours assets of your working preview, please ?
We can add a new type column, a boolean column.
Perhaps this column can extend the select column.
The filter propose true, false or undefined.
And the row is rendering with pictures.
Getting the following error when adding a filter to many-to-one columns:
An exception has been thrown during the rendering of a template ("[Syntax Error] line 0, col 845: Error: Expected =, <, <=, <>, >, >=, !=, got 'as'") in MyBundle:MyController:index.html.twig at line 67.
Problem, or simply not implemented?
Thanks
rename to order, should only reorder columns not filter them
First of all, thanks for the bundle, really awesome :)
I created the doctrine2 source in zfdatagrid and I wondered if it is possible to manipulate the QueryBuilder so that I can limit the rows that will be shown in the grid, maybe by adding some getter to the Grid/Source/Entity class!?
Let me know if I can help you there ;)
It would be nice if "From:" and "To:" for the RangeColumn Type could be translatable by the Translator.
I would try to implement it myself but i dont actually know how to inject or access the translator service in this context.
It might be a good idea to transform that render constructions into customizable Twig-Templates as well..
Add a column for row actions with the same actions of the mass action select, or not.
Plus, we can add icons before each action name, or instead of the name. And we can add these icons in the select of mass action. New internet browsers handle pictures in select tag.
We can use this implementation :
$actions->addAction(array(
'name' => 'Delete',
'callback' =>'YourProject\YourBundle\Controller\YourControllerClass::yourDeleteMethod'
'isMassAction' => true
'isRowAction' => true
'icon' => 'pathToThePicture'
)
);
If there is at less one column with the flag isMassAction, the select is visible.
If there is at less one column with the flag isRowAction, the column row action is visible.
What do you think ? I like this Enhancement
to be able get available options from db
when you are setting grid to template you are calling
$this->render('Foo:Page:index.html.twig', array('data' => $grid->prepare()));
new way can be
$this->render('Foo:Page:index.html.twig', array('data' => $grid));
and twig will call function prepare
for you when you are drawing grid
<!- twig ->
grid(data, _self) will call prepare() function for data
its ok for all?
If I remove the id parameter from the route and the indexAction function the grid renders without an error.
Symfony: 2.0.5
Twig: 1.1.2.
URL: http://localhost/proj/app_dev.php/default/1
Route:
AcmeTestBundle_default:
pattern: /default/{id}
defaults: { _controller: AcmeTestBundle:Default:index }
Controller:
namespace Acme\TestBundle\Controller;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Sorien\DataGridBundle\Grid\Source\Entity;
class DefaultController extends Controller
{
public function indexAction($id)
{
$source = new Entity('AcmeTestBundle:Sample');
$grid = $this->get('grid');
$grid->setSource($source);
return $this->render('AcmeTestBundle::test.html.twig', array('data' => $grid));
}
}
Template:
{{ grid(data) }}
export data as xml, excel, csv
use blocks from current twig template where grid() is called instead of defining another template like grid(data, 'custom_template') ... something like grid(data, _self)
Hello,
I have problem getting this thing to run. Not quite sure why but i have the impression there is a problem with the mapping of object members to database fields.
When launching the grid route symfony throws an exception: "No mapping found for field 'created_by' on class 'ProductBundle\Entity\Product'.
In my project I use annotations for the field definitions. 'created_by' is the name of the database field which is 'createdBy' in the object.
Any clue?
Thank you
Hi,
i search for a way to call the request data inside my callback but i have no direct idea what's the right way to do this.
Thank's for the time!
It would be nice if we can had buttons or a comboboxes to perform in one click simple or complex filters.
Exemple : Lets say you have three columns, first name, last name and country.
A combobox could propose to filter on the first and the country.
<select>
<option value="??">first=igor and country=EN</option>
<option value="??">first=igor</option>
<option value="??">last=gonzola</option>
</select>
Do you think this is already possible ?
Maybe I'm missing the obvious, but would it be possible to add some documentation about how the new route defined under "Step 3: Add a route to your grid" is used? I suspect this is for overriding grid behavior, but still not clear.
Looks like an awesome bundle BTW. Thanks very much for this.
its done automatically when source is set but there should be a own function save() and bindData() or something like this
$grid = get('grid')->set(new Source());
$grid->bindData();
if ($grid->isRedirectNeeded())
{
$grid->save();
//redirect
}
else
{
//render view
$grid->prepare();
}
any ideas how should it work?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.