LaravelRUS / SleepingOwlAdmin

🦉 Administrative interface builder for Laravel (Laravel admin)
http://sleepingowladmin.ru/
MIT License
799 stars 216 forks source link

filter labels are missing #1367

Closed eugenem closed 1 year ago

eugenem commented 1 year ago

I've tried to add labels to datatable filters. There is no such field, so I took placeholder and did override all filter controls. The only issue is that multi-select filter has no placeholder:

        if ($this->multiple) {
            $this->setHtmlAttribute('multiple', 'multiple');

            if (! in_array($this->operator, ['in', 'not_in'])) {
                $this->setOperator('in');
            }
        } else {
            $this->setHtmlAttribute('placeholder', $this->getPlaceholder());
        }

This is how I changed views:

<div {!! $width !!}>
    <label>{{@$attributesArray['placeholder']}}</label>
    <br>
  {!! Form::select('', $options, $default, $attributesArray) !!}
</div>

So whether placeholder should always be set, or just add labels explicitly

eugenem commented 1 year ago

another thing there is that for multi-select there should be no option with select title like with single select

I'm trying to make my own class for this, but it's not that simple...

daaner commented 1 year ago

Тебе нужен плейсхолдер при мультиселекте в фильтрах? Простое добавление $this->setHtmlAttribute('placeholder', $this->getPlaceholder()); в первое условие при пустом значении не достаточно? Для фильтров ты используешь select2 или multiselect?

eugenem commented 1 year ago

Плейсхолдер не работает в мультиселекте, я хочу лабел. Почти получилось, но не могу понять откуда там в опциях берется имя модели. В обычном селекте это полезно (типа не выбрано).

Вроде бы там везде селект2 стоит.

daaner commented 1 year ago

Я потыкаю и попробую в ближайшее время сделать. Просто если у тебя мультиселект аякс - там пишет типа "выберите" или что-то типа того. Но попробую впилить принудительно, если плейсхолдер указал

daaner commented 1 year ago

а какая версия? у меня дев ветка последняя. Не могу повторить проблему, плейсхолдеры у меня вылазят везде. image image

или ты в самом поле хотел?

eugenem commented 1 year ago

Ты ->multiple() включи и посмотри что будет...

eugenem commented 1 year ago

ну как, есть идеи что там творится?

daaner commented 1 year ago

Поправил и заодно стили сделал для темной и светлой темы.

eugenem commented 1 year ago

а как мне там на дев бранч переключиться? в релизах то его нет пока