Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The reset column filter functionality is broken when the datagrid is nested inside another component #855

Open
wants to merge 1 commit into
base: v5.x
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 0 additions & 12 deletions assets/src/datagrid.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -722,16 +722,4 @@ $.nette.ext('datagrid.reset-filter-by-column', {
if payload.non_empty_filters && payload.non_empty_filters.length
for key in payload.non_empty_filters
grid.find('[data-datagrid-reset-filter-by-column='+key+']').removeClass('hidden')

# Refresh their url (table header is not refreshed using snippets)
#
href = grid.find('.reset-filter').attr('href')

grid.find('[data-datagrid-reset-filter-by-column]').each ->
key = $(this).attr('data-datagrid-reset-filter-by-column')

new_href = href.replace('do=' + payload._datagrid_name + '-resetFilter', 'do=' + payload._datagrid_name + '-resetColumnFilter')
new_href += '&' + payload._datagrid_name + '-key=' + key

$(this).attr('href', new_href)
})
2 changes: 1 addition & 1 deletion src/DataGrid.php
Original file line number Diff line number Diff line change
Expand Up @@ -541,7 +541,6 @@ public function render()
$template->filter_active = $this->isFilterActive();
$template->original_template = $this->getOriginalTemplateFile();
$template->icon_prefix = static::$icon_prefix;
$template->icon_prefix = static::$icon_prefix;
$template->items_detail = $this->items_detail;
$template->columns_visibility = $this->getColumnsVisibility();
$template->columnsSummary = $this->columnsSummary;
Expand Down Expand Up @@ -2520,6 +2519,7 @@ public function reload($snippets = [])
{
if ($this->getPresenter()->isAjax()) {
$this->redrawControl('tbody');
$this->redrawControl('thead');
$this->redrawControl('pagination');
$this->redrawControl('summary');
$this->redrawControl('thead-group-action');
Expand Down
2 changes: 1 addition & 1 deletion src/templates/datagrid.latte
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@
{/block}
{/if}
<table class="{block table-class}table table-hover table-striped table-bordered table-sm{/block}" n:snippet="table" n:block="data">
<thead n:block="header">
<thead n:block="header" n:snippet="thead">
<tr class="row-group-actions" n:if="$hasGroupActions || $exports || $toolbar_buttons || $control->canHideColumns() || $inlineAdd" n:block="group-actions">
<th colspan="{$control->getColumnsCount()}" class="ublaboo-datagrid-th-form-inline">
{if $hasGroupActions}
Expand Down