appventus / avlistbundle Goto Github PK
View Code? Open in Web Editor NEWEasily make paginate and orderable list in Symfony2
Easily make paginate and orderable list in Symfony2
@thomasbeaujean created a part of code to define the colmuns directly in the service, we should use it and add the code in the view to generate automatically the list.
No more need to override the default view. Bipbip ๐
PHP :
/**
* Get column definition
*
* @param string $id The name of the column of the function of the object
* @param string $filter The name of the filter
* @param string $labelId The id of the label
* @param boolean $sortable Can this column be sorted
* @param string $sortableId The identifier of the sort
*
* @return array The array of a column definition
*/
public function getColumnDefinition($id, $filter = null, $labelId = null, $sortable = false, $sortableId = null)
{
//by default the id is used for the column label
if ($labelId === null) {
$labelId = $id;
}
//if sortable, then sortableId is mandatory
if ($sortable === true) {
if ($sortableId === null) {
throw new \Exception('The column '.$id.' is sortable but has no $sortableId defined');
}
}
$column = array(
'id' => $id,
'filter' => $filter,
'label' => $this->getLabelPrefix().$labelId,
'sortable' => $sortable,
'sortable_id' => $sortableId
);
return $column;
}
html.twig
{% for column in extra.columns %}
{% if column.sortable %}
<th class="sortable" data-filter="{{ column.sortable_id }}">{{ column.label|trans }}</th>
{% else %}
<th>{{ column.label|trans }}</th>
{% endif %}
{% endfor %}
We should be able to add a closure to render a column value and define a default column rendering.
when listvaluerender create a new twig environnement, forms doesn't 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.