Hi all,
I have a CCv5 list of data and I need them filter by dynamic dropdown. Max helped me with the code of dynamic dropdown menu:
filtering works fine, data are loaded by filter condiotion. values of dropdown:
Problem is as u can see that the form hasnt empty option so there isnt way how get back all data in list after using of filter. U cant show all data after filtering.
Max give me an advice to modify the line
to this:
after this modification is empty value in dropdown, but filtering doenst work.
As u can see, problem is in values of keys in array, that has 0..2 but the array should looks like previous array.
Array
(
[] =>
[501] => 501
[502] => 502
[553] => 553
)
any idea what is wrong?
thx
I have a CCv5 list of data and I need them filter by dynamic dropdown. Max helped me with the code of dynamic dropdown menu:
$keys = \GCore\Libs\Arr::getVal(\GCore\Libs\Arr::getVal($rows, explode(".", "[n].zakladni")), explode(".", "[n].filialka_id"));
$values = \GCore\Libs\Arr::getVal(\GCore\Libs\Arr::getVal($rows, explode(".", "[n].zakladni")), explode(".", "[n].filialka_id"));
$options = array_combine($keys, $values);
$field = array
(
'name' => 'fltr[zakladni][filialka_id]',
'id' => '',
'options' =>
array (
),
'empty' => '',
'values' =>
array (
),
'label' =>
array (
'text' => '',
'position' => 'left',
),
'sublabel' => '',
'multiple' => '0',
'size' => '',
'class' => '',
'title' => '',
'style' => '',
'params' => '',
':data-load-state' => '',
':data-tooltip' => '',
'type' => 'dropdown',
'container_id' => '0',
);
$field["options"] = $options;
echo \GCore\Helpers\Html::formLine($field["name"], $field);
echo '<div class="form-group gcore-form-row" id="form-row-1">
<div class="gcore-input gcore-display-table" id="fin-button3">
<input name="button3" id="button3" type="submit" value="Filtrovat" class="" style="" data-load-state="" />
</div>
</div>';
filtering works fine, data are loaded by filter condiotion. values of dropdown:
Array
(
[501] => 501
[502] => 502
[553] => 553
)
Problem is as u can see that the form hasnt empty option so there isnt way how get back all data in list after using of filter. U cant show all data after filtering.
Max give me an advice to modify the line
$options = array_combine($keys, $values);
to this:
options = array_merge(array('' => ''), array_combine($keys, $values));
after this modification is empty value in dropdown, but filtering doenst work.
Array
(
[] =>
[0] => 501
[1] => 502
[2] => 553
)
As u can see, problem is in values of keys in array, that has 0..2 but the array should looks like previous array.
Array
(
[] =>
[501] => 501
[502] => 502
[553] => 553
)
any idea what is wrong?
thx