I could be wrong about the way LeBlender works, but I think I'm experiencing a bug. I'm running Umbraco 7.4.1 and LeBlender 1.0.8.
I've created two grid editors using the LeBlender Editor, and for both I've ticked 'Render in the grid'. As such I'm expecting that when I'm in the Backoffice instead of seeing just the name of the grid editor (in my case 'Service' and 'Brand') that I would see the same HTML as is output from the frontend, which is working fine. Is that not right? To be clear it doesn't working even when I just put a static
tag in my render view so it's not an error in my code - I'm pretty sure.
So I still have this and since adding a 404 page, and seeing that in the grid, it appears that the AJAX call /umbraco/backoffice/leblender/Helper/GetPartialViewResultAsHtmlForEditor is returning
Cannot bind source type Newtonsoft.Json.Linq.JObject to model type Umbraco.Core.Models.PublishedContent.PublishedContentModel.
This is presumable because I'm using the Models Builder and the model factory is returning something different to that expected. Any ideas how I solve this without ripping out LeBlender?
The cause is that the API call to load the content in the back office, then calls Base.cshtml directly as if it were a View not a Partial View. Because I have a _ViewStart.cshtml setting a default Layout this Layout was getting called. However my Layout was expecting a model of a specific type, but a JObject as the API controller supplies.
It happens because the layout you have defined in the ViewStart file will affect everything being rendered through mvc, unless it specifically defines that it should be rendered without a layout.
If you just put another _ViewStart.cshtml in your Views\Partials\Grid\Editors folder and set the Layout = null; in that file - it will override the ViewStart you have defined in the Views folder - but only in this specific subfolder (which is what we want).
This allows you to still use the ViewStart for all your normal views, while still being able to use the LeBlender renderer.
Render in the grid not working
I could be wrong about the way LeBlender works, but I think I'm experiencing a bug. I'm running Umbraco 7.4.1 and LeBlender 1.0.8.
I've created two grid editors using the LeBlender Editor, and for both I've ticked 'Render in the grid'. As such I'm expecting that when I'm in the Backoffice instead of seeing just the name of the grid editor (in my case 'Service' and 'Brand') that I would see the same HTML as is output from the frontend, which is working fine. Is that not right? To be clear it doesn't working even when I just put a static
tag in my render view so it's not an error in my code - I'm pretty sure.
So I still have this and since adding a 404 page, and seeing that in the grid, it appears that the AJAX call /umbraco/backoffice/leblender/Helper/GetPartialViewResultAsHtmlForEditor is returning
Cannot bind source type Newtonsoft.Json.Linq.JObject to model type Umbraco.Core.Models.PublishedContent.PublishedContentModel.
This is presumable because I'm using the Models Builder and the model factory is returning something different to that expected. Any ideas how I solve this without ripping out LeBlender?
I believe this is the issue: https://our.umbraco.org/projects/backoffice-extensions/leblender/bug-reports/70675-umbraco-728-compatibility
So I fixed this by adding
to /Views/Partials/Grid/Base.cshtml
The cause is that the API call to load the content in the back office, then calls Base.cshtml directly as if it were a View not a Partial View. Because I have a _ViewStart.cshtml setting a default Layout this Layout was getting called. However my Layout was expecting a model of a specific type, but a JObject as the API controller supplies.
This didn't work for me. It turns out I also had to completely remove/rename the _viewstart.cshtml file from my project.
It happens because the layout you have defined in the ViewStart file will affect everything being rendered through mvc, unless it specifically defines that it should be rendered without a layout.
If you just put another
_ViewStart.cshtml
in yourViews\Partials\Grid\Editors
folder and set theLayout = null;
in that file - it will override the ViewStart you have defined in the Views folder - but only in this specific subfolder (which is what we want).This allows you to still use the ViewStart for all your normal views, while still being able to use the LeBlender renderer.
Sweet, thanks!
is working on a reply...