{"action":"created","issue":{"url":"https://api.github.com/repos/stwe/DatatablesBundle/issues/304","repository_url":"https://api.github.com/repos/stwe/DatatablesBundle","labels_url":"https://api.github.com/repos/stwe/DatatablesBundle/issues/304/labels{/name}","comments_url":"https://api.github.com/repos/stwe/DatatablesBundle/issues/304/comments","events_url":"https://api.github.com/repos/stwe/DatatablesBundle/issues/304/events","html_url":"https://github.com/stwe/DatatablesBundle/issues/304","id":139886387,"number":304,"title":"action render if entity joined exist.","user":{"login":"Falar81","id":5920088,"avatar_url":"https://avatars.githubusercontent.com/u/5920088?v=3","gravatar_id":"","url":"https://api.github.com/users/Falar81","html_url":"https://github.com/Falar81","followers_url":"https://api.github.com/users/Falar81/followers","following_url":"https://api.github.com/users/Falar81/following{/other_user}","gists_url":"https://api.github.com/users/Falar81/gists{/gist_id}","starred_url":"https://api.github.com/users/Falar81/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Falar81/subscriptions","organizations_url":"https://api.github.com/users/Falar81/orgs","repos_url":"https://api.github.com/users/Falar81/repos","events_url":"https://api.github.com/users/Falar81/events{/privacy}","received_events_url":"https://api.github.com/users/Falar81/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/stwe/DatatablesBundle/labels/enhancement","name":"enhancement","color":"84b6eb"},{"url":"https://api.github.com/repos/stwe/DatatablesBundle/labels/support%20question","name":"support question","color":"009800"}],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":3,"created_at":"2016-03-10T13:31:47Z","updated_at":"2016-04-05T07:55:07Z","closed_at":"2016-04-04T19:55:01Z","body":"I have a many to many relationship between orders and invoices, and I wish you could see the action button only if there is a relationship. I did this..\r\n.....\r\n```\r\n->add('invoice.id', 'array', array(\r\n                    'title' => '',\r\n                    'data' => 'invoice[, ].id', // required option\r\n                    'visible'=>false\r\n                ))\r\n```\r\n\r\nand in action..\r\n```\r\narray(\r\n    \"route\" => \"fattura_dettaglio\",\r\n                            \"route_parameters\" => array(\r\n                                \"id\" => \"invoice[0].id\"\r\n                            ),\r\n                            \"icon\" => \"iconSprite subf\",\r\n                            \"attributes\" => array(\r\n                                \"rel\" => \"tooltip\",\r\n                                \"title\" => \"invoice details view\",\r\n                                //\"class\" => \"btn btn-primary btn-xs\",\r\n                                //\"role\" => \"button\"\r\n                            ),\r\n                            \"render_if\" => array('invoice'=> 'true'),\r\n                        ),\r\narray(\r\n                            \"route\" => \"ordini_generafatturafromordine\",\r\n                            \"route_parameters\" => array(\r\n                                \"id\" => \"id\"\r\n                            ),\r\n                            \"icon\" => \"iconSprite subgenf\",\r\n                            \"attributes\" => array(\r\n                                \"rel\" => \"tooltip\",\r\n                                \"title\" => \"invoice create\",\r\n                                //\"class\" => \"btn btn-primary btn-xs\",\r\n                                //\"role\" => \"button\"\r\n                            ),\r\n                            \"render_if\" => array('invoice' => 'false'),\r\n                        ),\r\n\r\n```\r\n\r\n but the buttons are not rendered.\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/stwe/DatatablesBundle/issues/comments/205708260","html_url":"https://github.com/stwe/DatatablesBundle/issues/304#issuecomment-205708260","issue_url":"https://api.github.com/repos/stwe/DatatablesBundle/issues/304","id":205708260,"user":{"login":"Falar81","id":5920088,"avatar_url":"https://avatars.githubusercontent.com/u/5920088?v=3","gravatar_id":"","url":"https://api.github.com/users/Falar81","html_url":"https://github.com/Falar81","followers_url":"https://api.github.com/users/Falar81/followers","following_url":"https://api.github.com/users/Falar81/following{/other_user}","gists_url":"https://api.github.com/users/Falar81/gists{/gist_id}","starred_url":"https://api.github.com/users/Falar81/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Falar81/subscriptions","organizations_url":"https://api.github.com/users/Falar81/orgs","repos_url":"https://api.github.com/users/Falar81/repos","events_url":"https://api.github.com/users/Falar81/events{/privacy}","received_events_url":"https://api.github.com/users/Falar81/received_events","type":"User","site_admin":false},"created_at":"2016-04-05T07:55:07Z","updated_at":"2016-04-05T07:55:07Z","body":"OK, this is my situation:\r\n\r\n**Invoices entity:**\r\n```\r\n/**\r\n     * @ORM\\ManyToMany(targetEntity=\"Kritek\\Bundle\\GestionaleBundle\\Entity\\Orders\", mappedBy=\"invoice\")\r\n     **/\r\n    private $order;\r\n```\r\n\r\n**Orders entity:**\r\n```\r\n/**\r\n     * @ORM\\ManyToMany(targetEntity=\"Kritek\\Bundle\\GestionaleBundle\\Entity\\Invoices\", inversedBy=\"order\")\r\n     * @ORM\\JoinTable(name=\"Orders_invoices\")\r\n     **/\r\n    private $invoice;\r\n```\r\n\r\n**Datatable Orders:**\r\n```\r\n->add(null, \"action\", array(\r\n                    \"title\" => \"Azioni\",\r\n                    //\"start\" => '<div class=\"wrapper\">',\r\n                    //\"end\" => '</div>',\r\n                    \"width\" => \"80px\",\r\n                    \"actions\" => array( // IF there is at least an invoice , I view the details\r\n                                                  array(\r\n                            \"route\" => \"fattura_dettaglio\",\r\n                            \"route_parameters\" => array(\r\n                                \"id\" => \"invoice[0].id\"\r\n                            ),\r\n                            \"icon\" => \"iconSprite subf\",\r\n                            \"attributes\" => array(\r\n                                \"rel\" => \"tooltip\",\r\n                                \"title\" => \"Invoices Details\",\r\n                                //\"class\" => \"btn btn-primary btn-xs\",\r\n                                //\"role\" => \"button\"\r\n                            ),\r\n                            'render_if' => function($rowEntity) {\r\n                                return (count($rowEntity['invoice']) > 0);\r\n                            },\r\n                        ),\r\n                        array(  // otherwise I display the detail button\r\n                            \"route\" => \"ordini_generafatturafromordine\",\r\n                            \"route_parameters\" => array(\r\n                                \"id\" => \"id\"\r\n                            ),\r\n                            \"icon\" => \"iconSprite subgenf\",\r\n                            \"attributes\" => array(\r\n                                \"rel\" => \"tooltip\",\r\n                                \"title\" => \"Create Invoice\",\r\n                                //\"class\" => \"btn btn-primary btn-xs\",\r\n                                //\"role\" => \"button\"\r\n                            ),\r\n                            \"render_if\" => array('invoice[0]' => 'undefined'),\r\n                        ),\r\n                        ......\r\n```\r\n\r\n\r\n\r\nI tried your solution above, but I get this error:\r\nThe option \"render_if\" with value Closure is expected to be of type \"array\", but is of type \"Closure\".\r\ni need to view the button on the action group buttons\r\nwhere am I wrong ?\r\nThanks."}}