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

ChoiceField : Widget height and renderAsBadges function not working #5011

Closed
fdiedler opened this issue Jan 31, 2022 · 14 comments · Fixed by #5125
Closed

ChoiceField : Widget height and renderAsBadges function not working #5011

fdiedler opened this issue Jan 31, 2022 · 14 comments · Fixed by #5125
Milestone

Comments

@fdiedler
Copy link

fdiedler commented Jan 31, 2022

Describe the bug
Using the ChoiceField with multiple choices render as a native widget, there is a bug with the height of the widget.
We only see the first choice like in this picture

ea_choice_field_bug

The code

    public function configureFields(string $pageName): iterable
    {
        $markets = $this->getDoctrine()->getRepository(Market::class)->findActive();
        $choiceMarkets = [];
        foreach ($markets as $market)
        {
            $choiceMarkets[$market->getName()] = $market->getId();
        }
        
        return [
            ChoiceField::new('allowedMarkets')
                ->setChoices($choiceMarkets)
                ->allowMultipleChoices()
                //->renderExpanded()
                ->renderAsNativeWidget()
                ->renderAsBadges(true) // seems not to work
            ,
            
            BooleanField::new('enabled', 'Actif'),
        ];
    }

Furthermore, the renderAsBadges() seems not to work. Nothing happens whatever I use as parameter.

To Reproduce
Just create a simple Crud controller with a ChoiceField with multiple choices. I use the EA v4.0.3 release.

Thanks,

@javiereguiluz
Copy link
Collaborator

renderAsBadges() is only for read-only pages (index and detail). The other option (renderAsNativeWidget()) it is for form pages and it should work ... so your report seem like a bug. Could you please check which CSS styles are making this to not work? Ideally, if you have time, please also send a pull request to fix that. Thanks!

@javiereguiluz javiereguiluz added this to the 3.x milestone Jan 31, 2022
@fdiedler
Copy link
Author

fdiedler commented Jan 31, 2022

@javiereguiluz Okay for renderAsBadges() function. There is no documentation available for this field but I think it is just a question of time ;)

The css class that does not work properly seems to be "form-select" apply to "select" element.

Sure, I will open a PR now

@fdiedler
Copy link
Author

@javiereguiluz Sorry, I cannot open a PR, the "Createa Pull Request" button is disabled...

@michaelKaefer
Copy link
Contributor

@fdiedler Where is this button? Did you already create a "fork" and commit your changes? Normally everybody has the permissions to create a PR.

@fdiedler
Copy link
Author

@michaelKaefer I go in the "Pull requests" section then "New pull request". And I was not able to create a PR because the button is disabled.

I don't know why I need to fork something, on others repositories, I just need to "Create a PR", describe the bug or feature and then submit.

@michaelKaefer
Copy link
Contributor

@fdiedler Ok, for me this is also disabled. But sorry, I can't help you, I never used this button. Do you think there is a problem spcifically to this repo?

Or can you edit the file in your browser by opening the file in GitHub and then click on the edit icon on the top right? I think then you can submit a PR quite sure. - Or the best way in my opinion is to create a fork and develop on my computer.

@fdiedler
Copy link
Author

@michaelKaefer It is the first time that I cannot use this button for creating a PR, so I think it is a problem of rights.
Maybe @javiereguiluz will have an explanation ?

I don't know how to fix this bug, I just report that I think the css class that does not work properly is "form-select" apply to "select" element.

@javiereguiluz
Copy link
Collaborator

In the past we've limited contributions temporarily (https://easycorp.github.io/blog//posts/a-month-without-contributions) but I haven't activated anything like that, so I don't know how can't you create a PR 😐

@fdiedler
Copy link
Author

@javiereguiluz @michaelKaefer I found a trick to enable the "Pull request" button but I don't know if it is good because I selected the 3.x branch like shown in this picture

PR

Can I fill the form and submit the PR ?

@michaelKaefer
Copy link
Contributor

Hm, somehow it looks like that would create a PR to merge the branch 4.x into the branch 3.x, or?

What do you want to do? Do you want to change the code of a file of EasyAdmin?

@fdiedler
Copy link
Author

fdiedler commented Feb 1, 2022

@michaelKaefer No, I don't want to change a file nor code something, I don't have competences to modify EA bundle.
I just want to open a PR in order to inform the community and waiting another person to fix this bug. But maybe, it does not work as it for EA repository ?

@michaelKaefer
Copy link
Contributor

@fdiedler I never heard of this procedure and I don't know if it is possible in EA. Anyway, if you don't want to change the source code there is no sense in opening a PR in my opinion, because PRs are for code changes. It is enough that you created this issue as far as I know :)

@fdiedler
Copy link
Author

fdiedler commented Feb 4, 2022

@michaelKaefer Okay, that is what I thought.
This issue should be easy to fix because it seems to be only a problem with the form-select css class
Thanks for the explanation

@michaelKaefer
Copy link
Contributor

Then let's hope somebody will fix it :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants