You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Jul 25, 2023. It is now read-only.
@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.
The text was updated successfully, but these errors were encountered:
@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 :
html.twig
We should be able to add a closure to render a column value and define a default column rendering.
The text was updated successfully, but these errors were encountered: