Skip to content

Commit

Permalink
Searching recursively in sub-tables should work as expected (#10303)
Browse files Browse the repository at this point in the history
* When a datatable is manipulated in memory, the correct id subtable is stored in metadata and must be fetched from there.
  • Loading branch information
mattab committed Jul 15, 2016
1 parent cb9192d commit 319f519
Showing 1 changed file with 3 additions and 2 deletions.
Expand Up @@ -20,6 +20,7 @@
{% else %}
{%- for rowId, row in dataTable.getRows() -%}
{%- set rowHasSubtable = not subtablesAreDisabled and row.getIdSubDataTable() and properties.subtable_controller_action is not null -%}
{%- set rowSubtableId = row.getMetadata('idsubdatatable_in_db')|default(row.getIdSubDataTable()) -%}
{%- set isSummaryRow = rowId == constant('Piwik\\DataTable::ID_SUMMARY_ROW') -%}
{%- set shouldHighlightRow = isSummaryRow and properties.highlight_summary_row -%}

Expand All @@ -30,7 +31,7 @@
or not properties.replace_row_with_subtable|default(false) -%}

{% if showRow %}
<tr {% if rowHasSubtable %}id="{{ row.getIdSubDataTable() }}"{% endif %}
<tr {% if rowHasSubtable %}id="{{ rowSubtableId }}"{% endif %}
{% if row.getMetadata('segment') is not false %} data-segment-filter="{{ row.getMetadata('segment')|e('html_attr') }}"{% endif %}
{% if row.getMetadata('url') is not false %} data-url-label="{{ row.getMetadata('url')|rawSafeDecoded }}"{% endif %}
data-row-metadata="{{ row.getMetadata|json_encode|e('html_attr') }}"
Expand All @@ -46,7 +47,7 @@

{# display subtable if present and showing expanded datatable #}
{% if properties.show_expanded|default(false) and rowHasSubtable %}
{% include "@CoreVisualizations/_dataTableViz_htmlTable.twig" with {'dataTable': row.getSubtable(), 'idSubtable': row.getIdSubDataTable()} %}
{% include "@CoreVisualizations/_dataTableViz_htmlTable.twig" with {'dataTable': row.getSubtable(), 'idSubtable': rowSubtableId} %}
{% endif %}
{%- endfor -%}
{% endif %}
Expand Down

0 comments on commit 319f519

Please sign in to comment.