2

I'm having trouble with the Sonata Admin Bundle, which runs on Symfony2.

I have an entity with an enum field, which I converted to string, because there are no enums available.

I used choice as a type of the list view, and provided my options. Works great in edit view - I can select from a list of options, and the actual value from DB is highlighted.

But I would like to be able to edit this inline (in list view, not in edit). I've added 'editable' => true, which works great, but the type of field I'm getting in edit is a simple text one - I can input anything there.

I've tried all the miracles I could find online, and nothing helps.

This works by default on the boolean types - it indicates yes and no (green and red) buttons, and when I click any, I get a select box with the two options to chose from. And all that happens inline.

Any ideas how to achieve that?

Thanks!

Andrey Popov
  • 7,362
  • 4
  • 38
  • 58
  • I m very intersted by such a feature :D – Charles-Antoine Fournel Apr 17 '14 at 14:04
  • Come on guys, any ideas? :) – Andrey Popov May 12 '14 at 13:27
  • I just took a look in this. I'm not sure if it's the right way, but I think you could try to owerride sonata_xeditable_type twig filter, so it return 'select' for field of type 'choice', later on override (or just switch it in listMapper) the template CRUD/list_choice.html.twig so it depend on field_description.options.editable just like in /CRUD/list_boolean.html.twig :-) seems a bit complicated at least – tiriana Jun 03 '14 at 10:18
  • Thanks for the reply! I will try this solution and check what's going on. I was sure I can make it by overriding those templates and methods, but I was hoping it won't be that hard as long as it seems so simple and obvious one.. – Andrey Popov Jun 07 '14 at 09:53
  • 1
    Have you found a solution @AndreyPopov ? Otherwise I think they are working on this issue / feature: https://github.com/sonata-project/SonataAdminBundle/issues/1023 – webDEVILopers Aug 28 '14 at 11:32
  • I still can't understand this. I've browsed for 2 hours and got into 10 different requests/posts/merges. It seems they haven't implemented it yet, and I can't imagine I'll override several files just to get such a simple inline edit for choices (your date example is a bit more reasonable). – Andrey Popov Feb 09 '15 at 10:00
  • I'm currently watching the following issues and waiting for good news too! - https://github.com/sonata-project/SonataAdminBundle/issues/2324 - https://github.com/sonata-project/SonataAdminBundle/issues/2269 – webDEVILopers May 12 '15 at 18:52

0 Answers0