diff --git a/Resources/views/datatable/button.html.twig b/Resources/views/datatable/button.html.twig index 6540db71..52c8da10 100644 --- a/Resources/views/datatable/button.html.twig +++ b/Resources/views/datatable/button.html.twig @@ -50,7 +50,7 @@ namespace: "{{ button.namespace }}", {% endif %} {% if button.text is defined and button.text is not same as(null) %} - text: "{{ button.text }}", + text: "{{ button.text|e('js') }}", {% endif %} {% if button.titleAttr is defined and button.titleAttr is not same as(null) %} titleAttr: "{{ button.titleAttr }}", diff --git a/Response/DatatableFormatter.php b/Response/DatatableFormatter.php index 6d72f0b2..17da5540 100644 --- a/Response/DatatableFormatter.php +++ b/Response/DatatableFormatter.php @@ -105,6 +105,19 @@ public function runFormatter(Paginator $paginator, DatatableInterface $datatable $row[$data] = $row[$dql]; unset($row[$dql]); } + } + else if(false === $this->accessor->isReadable($row, $path)) + { + // Set empty values for the path of an association without object + $pathParts = explode('.', $column->getData()); + $buildPath = ''; + foreach($pathParts as $part) + { + if(false === $this->accessor->isReadable($row, $buildPath.'['.$part.']')) + $this->accessor->setValue($row, $buildPath, array($part => null)); + + $buildPath .= '['.$part.']'; + } } }