Closed mplabs closed 9 years ago
The problem was that I set _serialize in my AppController. This will cause JsonView::render to not render the datatable view file.
Can you paste the relevant code? Thanks. On Feb 8, 2015 8:38 AM, "Felix Dürrwald" notifications@github.com wrote:
The problem was that I set _serialize in my AppController. This will cause JsonView::render to not render the datatable view file.
— Reply to this email directly or view it on GitHub https://github.com/tigrang/cakephp-datatable/issues/57#issuecomment-73418549 .
In my AppController:beforeFilter() function I had
$this->set('_serialize', array('user'));
Now in [CORE]/Cake/View/JsonView.php:103-109 you have
public function render($view = null, $layout = null) {
$return = null;
if (isset($this->viewVars['_serialize'])) {
$return = $this->_serialize($this->viewVars['_serialize']);
} elseif ($view !== false && $this->_getViewFileName($view)) {
$return = parent::render($view, false);
}
[...]
Because of that, if you have set the _serialize
view variable, the JsonView will not render any template you might have in [APP]/View/{model}/datatable/{config}.ctp
but will instead just dump your variables, hence you have no view processing.
I don't know if that is actually a bug or if it should just be stated in the docs as an edge-case.
You are right. Let me look into this.
Why do you have a _serialize
in AppController::beforeFilter()
though?
I have a javascript application running in the background that will fetch certain pages or just data. A lot of the time, I need the logged in user for these requests. That's why I was setting it. I am now changing it to just hav the _serialize set when I really need it.
Fixing it is pretty trivial, but I feel like _serialize shouldn't be set in the first place. I'm going to close this issue.
Thanks for trying out the new version btw :) Any other issues or things you wish were different?
I'm trying to get the extra view processing to work. I disabled autoRender and created a /app/View/[Model]/datatable/[config_name].ctp file. This file is not processed, all I get is an empty response. What am I doing wrong?