Search code examples
symfonysonata-admin

Embbed listview to formview with sonata admin bundle


What is the best way to embbed the datagrid list of an SonataAdmin entity to another entity EditForm ?

I can't find the process in the doc.

Thanks for your help


Solution

  • Go to the desired list. Copy the url from your browser:

    Now with jQuery :

    $.get(url_you_just_copied, function(result){
       console.log(result);
    };
    

    Have a look at what you are getting back from the listAction call and adapt the request parameters (filters, ...) accordingly to get the list you wanted.

    Next to have a clean solution you need to generate your url with the twig helper: https://stackoverflow.com/a/15857401/5758328