Forum Discussion

Silutions's avatar
02-22-2022
Solved

Use of Conditions in BloX Column sets/columns

I would like to be able to filter BloX column Panel Items & Values based on a conditional.  In my use case we have something similar to the mockup below: The goal is to be able to filter the p...
  • harikm007's avatar
    harikm007
    02-25-2022

    Silutions ,

    Please use this JSON:

    {
        "style": ".content{counter-reset:section} .casesrank::before {counter-increment: section;  content: 'Top ' counter(section) ' Product';} .productitems{float:left; border:2px solid grey}",
        "showCarousel": false,
        "body": [
            {
                "type": "Container",
                "class": "titlearea",
                "width": "100%",
                "items": [
                    {
                        "type": "TextBlock",
                        "size": "light",
                        "weight": "bold",
                        "horizontalAlignment": "left",
                        "color": "default",
                        "text": "Top 6 Products in {panel:xxxx}"
                    },
                    {
                        "type": "TextBlock",
                        "size": "light",
                        "weight": "bold",
                        "horizontalAlignment": "left",
                        "color": "default",
                        "text": "{panel:xxx} Units: {panel:yyy} of Total Sold"
                    },
                    {
                        "type": "TextBlock",
                        "size": "light",
                        "weight": "bold",
                        "horizontalAlignment": "left",
                        "color": "default",
                        "text": "{panel:mmmm} of Total Net Sales"
                    },
                    {
                        "type": "TextBlock",
                        "spacing":"small"
                    }
                ]
            },
            {
                "type": "Container",
                "width": "16%",
                "class": "productitems",
                "items": [
                    {
                        "type": "TextBlock",
                        "size": "light",
                        "weight": "bold",
                        "horizontalAlignment": "center",
                        "spacing": "small",
                        "class": "casesrank",
                        "color": "default",
                        "text": ""
                    },
                    {
                        "type": "Image",
                        "url": "{panel:ProductImageURL}",
                        "spacing": "small",
                        "horizontalAlignment": "center",
                        "size": "small"
                    },
                    {
                        "type": "TextBlock",
                        "size": "light",
                        "weight": "bold",
                        "horizontalAlignment": "center",
                        "spacing": "small",
                        "color": "default",
                        "text": "{panel:ProductTitle}"
                    },
                    {
                        "type": "TextBlock",
                        "size": "light",
                        "weight": "bold",
                        "horizontalAlignment": "center",
                        "spacing": "small",
                        "color": "default",
                        "text": "{panel:CasesSold} units"
                    }
                ]
            }
        ]
    }

    And add below widget script to remove all containers except first:

    widget.on('ready', function(se, ev){
    	$("div.titlearea").not(":first").hide();
    })

    Result:

    -Hari