Prepísanie nazvu battonu v ublaboo/datagride + pridanie buttonu
- KristianSubweb
- Člen | 146
Ahojte potrebujem prepísať Názov v buttone plus pridať další do toolbaru v datagride.
Lenže nazaril som na problém s tím že ked ho pridám do šablony src/templates/datagrid.latte tak mi ho vobec nechce vykresliť. Neriešili ste niekto niečo podobné ?
{snippet resetfiltersnippet}
{if $control->hasOuterFilterRendering()}
<button class="btn btn-xs btn-primary active" style="margin-right: 10px;" type="button" data-toggle="collapse" data-target="#datagrid-{$control->getName()}-row-filters">
<i class="{$icon_prefix}filter"></i>
</button>
{/if}
<a n:if="$filter_active" n:href="resetFilter!"
class="ajax btn btn-danger btn-sm reset-filter" style="padding: 1px 10px; margin-right: 10px;">
<span class="fa fa-minus-circle"></span> {_is.default.reset}</a>
<button type="button" class="btn btn-xs btn-default dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false" n:if="$control->canHideColumns()">
<i n:block = "icon-gear" class="{$icon_prefix}gear"></i>
</button>
<button type="button" class="btn btn-xs btn-default dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false" n:if="$control->canHideColumns()">
MOJ BUTTON
</button>
<ul class="dropdown-menu dropdown-menu-right dropdown-menu--grid">
<li n:foreach="$columns_visibility as $v_key => $visibility">
{if $visibility['visible']}
<a n:href="hideColumn!, column => $v_key" class="ajax">
<i n:block = "icon-checked" class="{$icon_prefix}check-square-o"></i>
{include #column-header, column => $visibility['column']}
</a>
{else}
<a n:href="showColumn!, column => $v_key" class="ajax">
<i n:block = "icon-unchecked" class="{$icon_prefix}square-o"></i>
{include #column-header, column => $visibility['column']}
</a>
{/if}
</li>
<li role="separator" class="divider"></li>
<li>
<a n:href="showAllColumns!" class="ajax"><i n:block = "icon-eye" class="{$icon_prefix}eye"></i> {='ublaboo_datagrid.show_all_columns'|translate}</a>
</li>
<li n:if="$control->hasSomeColumnDefaultHide()">
<a n:href="showDefaultColumns!" class="ajax"><i n:block = "icon-repeat" class="{$icon_prefix}repeat"></i> {='ublaboo_datagrid.show_default_columns'|translate}</a>
</li>
</ul>
{/snippet}
Je to zvláštne aj ked ich vymažem stale tam ostanú je to podla tým snipetom. Už si fakt neviem dať rady HEEEELP :D
- KristianSubweb
- Člen | 146
Phalanx napsal(a):
Mohl bys příklad zjednodušit na úplné minimum? Překresluješ snippet z komponenty (ukaž kód handle)?
To to je ten handler ktorý je v datagrid.php
public function handleResetFilter()
{
/**
* Session stuff
*/
$this->deleteSessionData('_grid_page');
if ($this->default_filter_use_on_reset) {
$this->deleteSessionData('_grid_has_filtered');
}
if ($this->default_sort_use_on_reset) {
$this->deleteSessionData('_grid_has_sorted');
}
foreach ($this->getSessionData() as $key => $value) {
if (!in_array($key, [
'_grid_per_page',
'_grid_sort',
'_grid_page',
'_grid_has_filtered',
'_grid_has_sorted',
'_grid_hidden_columns',
'_grid_hidden_columns_manipulated',
], true)) {
$this->deleteSessionData($key);
}
}
$this->filter = [];
$this->redrawControl("resetfiltersnippet");
$this->reloadTheWholeGrid();
}