How to redirect to active tab after save object in sonata_admin Form

371 views
Skip to first unread message

Aleksandr Okhrimenko

unread,
Nov 4, 2016, 8:46:11 AM11/4/16
to sonata-users
Hi all!

I have sonata_admin FormView with several tabs.
For example, I'm editing object parameters on second tab - active tab.
After saving object without return to ListView I display FormView which open on first tab.
How to make redirection on second (active) tab after saving object?

Thanks

Cassiano Tartari

unread,
Nov 4, 2016, 8:56:09 AM11/4/16
to sonata-users
I think sonata admin uses https://jqueryui.com/tabs/ to handle tab changing, inspect the code. Probably you should override your edit template, override the redirectTo controller action to pass some parameter to twig and in edit template check this parameter to add some js to show the tab that you want. Or maybe you can handle all by js and twig, I don't remember if there is some parameter passed after create/update to template.

Att.,
Cassiano Tartari

--
You received this message because you are subscribed to the Google Groups "sonata-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to sonata-users+unsubscribe@googlegroups.com.
To post to this group, send email to sonata...@googlegroups.com.
Visit this group at https://groups.google.com/group/sonata-users.
For more options, visit https://groups.google.com/d/optout.

Aleksandr Okhrimenko

unread,
Nov 4, 2016, 9:07:19 AM11/4/16
to sonata-users
Thanks for your replay

I've been thinking about it.
Since there is to return on the list page from edit object:

   public function buildDatagrid() {
        $this->persistFilters = true;
        parent::buildDatagrid();
    }

may
be there is a similar way to return to the tab on EditView.


пятница, 4 ноября 2016 г., 14:56:09 UTC+2 пользователь Cassiano Tartari написал:
I think sonata admin uses https://jqueryui.com/tabs/ to handle tab changing, inspect the code. Probably you should override your edit template, override the redirectTo controller action to pass some parameter to twig and in edit template check this parameter to add some js to show the tab that you want. Or maybe you can handle all by js and twig, I don't remember if there is some parameter passed after create/update to template.

Att.,
Cassiano Tartari

2016-11-04 10:46 GMT-02:00 Aleksandr Okhrimenko <a.okhr...@gmail.com>:
Hi all!

I have sonata_admin FormView with several tabs.
For example, I'm editing object parameters on second tab - active tab.
After saving object without return to ListView I display FormView which open on first tab.
How to make redirection on second (active) tab after saving object?

Thanks

--
You received this message because you are subscribed to the Google Groups "sonata-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to sonata-users...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages