Work under way
- JS datagrid
- Datagrid generation with PHP
- PHP entities/objects datagrid (e.g. Doctrine entities)
- AJAX: async content loading
Javascript version:
var example1 = new Datagrid();
example1.addColumns([
new Column("title", "Title"),
new Column("description", "Description")
]);
example1.addRows([
{
"title": "Test",
"description": "This is a long description."
},
{
"title": "Another test",
"description": "This is another long description."
}
]);
example1.render(".datagrid-example");
PHP version:
$example1 = new Datagrid();
$example1->addColumns([
new Column("title", "Title"),
new Column("description", "Description"),
]);
$example1->addRows([
[
"title" => "Test",
"description" => "This is a long description.",
],
[
"title" => "Another test",
"description" => "This is another long description.",
],
]);
$datagridRenderer = new DatagridRenderer();
$datagridRenderer->render($example1);
$articlesDatagrid = new EntityDatagrid("articles");
$articlesDatagrid->addColumns([
new TextColumn("title", "Title"), // will map to $article->getTitle()
new LongTextColumn("description", "Description"), // will map to $article->getDescription()
new TextColumn("authorName", "Author", "author.name"), // will map to $article->getAuthor()->getName()
]);
$articlesDatagrid->setEntities($articles);
$datagridRenderer = new DatagridRenderer();
$datagridRenderer->render($articlesDatagrid);
See the examples above.
# views/datagrids/articles.yml
articles:
type: EntityDatagrid
columns:
title:
type: text
label: Article title
description:
type: longtext
label: Description
authorName:
type: text
label: Author
path: author.name
$articlesDatagrid = Datagrid::build("articles");
$articlesDatagrid->setEntities($articles);
$datagridRenderer = new DatagridRenderer();
$datagridRenderer->render($articlesDatagrid);
Javascript:
- jQuery
- Bootstrap (soft dependency, only used for layout and CSS)
PHP:
- Doctrine Collections: 1.*
- Symfony YAML: 2.*
- Symfony PropertyAccess
(dependencies are managed through Composer)