Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • David Peck 587 posts 1554 karma points c-trib
    Mar 18, 2016 @ 14:20
    David Peck
    0

    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.

    LeBlender Editor The grid editor

  • David Peck 587 posts 1554 karma points c-trib
    Apr 04, 2016 @ 14:20
    David Peck
    1

    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?

  • David Peck 587 posts 1554 karma points c-trib
    Aug 01, 2016 @ 10:23
  • David Peck 587 posts 1554 karma points c-trib
    Aug 01, 2016 @ 11:01
    David Peck
    1

    So I fixed this by adding

    @{
        Layout = "";
    }
    

    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.

  • Matthew Kirschner 322 posts 603 karma points
    Nov 08, 2016 @ 19:30
    Matthew Kirschner
    0
    @{
        Layout = "";
     }
    

    This didn't work for me. It turns out I also had to completely remove/rename the _viewstart.cshtml file from my project.

  • Claus Jensen 48 posts 115 karma points hq
    Nov 08, 2016 @ 21:48
    Claus Jensen
    2

    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.

  • Matthew Kirschner 322 posts 603 karma points
    Nov 08, 2016 @ 22:07
    Matthew Kirschner
    0

    Sweet, thanks!

Please Sign in or register to post replies

Write your reply to:

Draft