Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Fix filter block retrieving order

  • Loading branch information...
commit 7cede2d873b91a7aef485bfe4a98ae34b0aacd31 1 parent f8226c6
@Abhoryo authored
View
4 Resources/doc/template/filter_rendering.md
@@ -20,12 +20,12 @@ They are called before the default block.
* `grid_%id%_column_%column_id%_filter`
* `grid_%id%_column_type_%column_type%_filter`
- * `grid_%id%_column_filter_type_%column_filter_type%`
* `grid_%id%_column_type_%column_parent_type%_filter`
+ * `grid_%id%_column_filter_type_%column_filter_type%`
* `grid_column_%column_id%_filter`
* `grid_column_type_%column_type%_filter`
- * `grid_column_filter_type_%column_filter_type%`
* `grid_column_type_%column_parent_type%_filter`
+ * `grid_column_filter_type_%column_filter_type%`
**Note**: `.` and `:` characters in mapped field with a DQL aggregate function are replaced by an underscore.
View
22 Twig/DataGridExtension.php
@@ -209,12 +209,12 @@ public function getGridFilter($column, $grid, $submitOnChange = true)
if (($id != '' && ($this->hasBlock($block = 'grid_'.$id.'_column_'.$column->getRenderBlockId().'_filter')
|| $this->hasBlock($block = 'grid_'.$id.'_column_type_'.$column->getType().'_filter')
- || $this->hasBlock($block = 'grid_'.$id.'_column_filter_type_'.$column->getFilterType())
- || $this->hasBlock($block = 'grid_'.$id.'_column_type_'.$column->getParentType().'_filter')))
+ || $this->hasBlock($block = 'grid_'.$id.'_column_type_'.$column->getParentType().'_filter'))
+ || $this->hasBlock($block = 'grid_'.$id.'_column_filter_type_'.$column->getFilterType()))
|| $this->hasBlock($block = 'grid_column_'.$column->getRenderBlockId().'_filter')
|| $this->hasBlock($block = 'grid_column_type_'.$column->getType().'_filter')
- || $this->hasBlock($block = 'grid_column_filter_type_'.$column->getFilterType())
- || $this->hasBlock($block = 'grid_column_type_'.$column->getParentType().'_filter'))
+ || $this->hasBlock($block = 'grid_column_type_'.$column->getParentType().'_filter')
+ || $this->hasBlock($block = 'grid_column_filter_type_'.$column->getFilterType()))
{
return $this->renderBlock($block, array('grid' => $grid, 'column' => $column, 'submitOnChange' => $submitOnChange && $column->isFilterSubmitOnChange()));
}
@@ -230,23 +230,21 @@ public function getGridFilter($column, $grid, $submitOnChange = true)
*/
public function getGridUrl($section, $grid, $param = null)
{
- $separator = strpos($grid->getRouteUrl(), '?') ? '&' : '?';
+ $prefix = $grid->getRouteUrl().(strpos($grid->getRouteUrl(), '?') ? '&' : '?').$grid->getHash().'[';
switch ($section) {
case 'order':
if ($param->isSorted()) {
- return $grid->getRouteUrl().$separator.$grid->getHash().'['.Grid::REQUEST_QUERY_ORDER.']='.$param->getId().'|'.($param->getOrder() == 'asc' ? 'desc' : 'asc');
+ return $prefix.Grid::REQUEST_QUERY_ORDER.']='.$param->getId().'|'.($param->getOrder() == 'asc' ? 'desc' : 'asc');
} else {
- return $grid->getRouteUrl().$separator.$grid->getHash().'['.Grid::REQUEST_QUERY_ORDER.']='.$param->getId().'|asc';
+ return $prefix.Grid::REQUEST_QUERY_ORDER.']='.$param->getId().'|asc';
}
case 'page':
- return $grid->getRouteUrl().$separator.$grid->getHash().'['.Grid::REQUEST_QUERY_PAGE.']='.$param;
+ return $prefix.Grid::REQUEST_QUERY_PAGE.']='.$param;
case 'limit':
- return $grid->getRouteUrl().$separator.$grid->getHash().'['.Grid::REQUEST_QUERY_LIMIT.']=';
+ return $prefix.Grid::REQUEST_QUERY_LIMIT.']=';
case 'reset':
- return $grid->getRouteUrl().$separator.$grid->getHash().'['.Grid::REQUEST_QUERY_RESET.']=';
- case 'export':
- return $grid->getRouteUrl().$separator.$grid->getHash().'['.Grid::REQUEST_QUERY_EXPORT.']='.$param;
@sterrien Collaborator

Hi Abhoryo !

I've just pull the last version of APYDataGridBundle. Is there a reason you've remove the two above lines concerning 'export' ?

@Abhoryo Owner
Abhoryo added a note

I don't think so.

@sterrien Collaborator

Ok, I write them back.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
+ return $prefix.Grid::REQUEST_QUERY_RESET.']=';
}
}
Please sign in to comment.
Something went wrong with that request. Please try again.