Copied to clipboard

Flag this post as spam?

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


  • John P Scott 14 posts 71 karma points
    Mar 24, 2023 @ 15:14
    John P Scott
    0

    Finding the column span of a blockgrid item in a custom back office view

    Hi, I have a blockgrid item which changes layout on the front end depending on the number of columns set in the backoffice. e.g. Two 'CardBlock' block types but different col spans

    I want to replicate this in a custom backoffice view, but cannot find how to get the columnSpan layout setting from the block in Angular.

    I have logic like so:

    {{wide = block.layout.columnSpan == 12; ""}}
     <div ng-if="wide == true">
          -- wide layout code here -
     </div>
     <div ng-if="wide != true">
          -- narrow layout code here -
    </div>
    

    If tried all sorts of variations around the theme of 'block.layout.columnSpan' but can't inspect the json for 'block' to determine the correct syntax.

    Can someone please point me in the right direction.

    regards

    John

  • Huw Reddick 1737 posts 6077 karma points MVP c-trib
    Mar 24, 2023 @ 15:51
    Huw Reddick
    1

    what is going wrong? pretty sure it is block.layout.columnSpan

    from blockgrid example

    <button class="card"
            ng-class="{'--medium': block.layout.columnSpan === 6}"
            type="button"
            ng-click="block.edit()"
            ng-focus="block.focus">
    
  • John P Scott 14 posts 71 karma points
    Mar 24, 2023 @ 16:27
    John P Scott
    0

    Thanks Huw,

    I'll strip back my code to bare bones to see what's happening. May start with just the example from the blockgrid package.

    I'll post again once I've tried.

    Cheers

    John

  • John P Scott 14 posts 71 karma points
    Mar 24, 2023 @ 16:43
    John P Scott
    0

    Hi Huw,

    That works as expected. Thank you again.

    Cheers

    John

Please Sign in or register to post replies

Write your reply to:

Draft