Block grid rowspawn / based on parent layout
# help-with-umbraco
a
see below
Al good I'd say, expect the rowspawn of the left-column is 1, i'd expect it to be 2 I think, the same as its parent, as that area is defined as to 2 in size, or am I mistaken here? Anyways, my problem is the following, I render an ImageElement in each of these. However there are different sizes for each area. I can render a correct crop for the first and the 3/4th ones (the small ones), based on the colspan, but for the second one I have no definitation on how to do this.. As the second (top right) one is has the same settings as the left one, the same crop is rendered, interrupting the layout. Any a suggestion on how to can I have the top-right one render a different crop? Now that I'm writing this, I could make a different element with the same properties and handle it that way, but that feels a bit off..
d
Perhaps not the answer that you're looking for, but personally, I (usually) only reuse element types if they have the same meaning in the new context. That means that an element doesn't necessarily have to be the same, just because they have the same data. So... if your second element has the same data, but isn't really the same thing, then I think it's very reasonable to create a different element with the same properties. Just a thought...
a
Ye was aiming to that too, but hoped to keep it simpler
Would be great if you could pull up the area info the element is in though
Just like the colspan
d
It's very odd that the rowspan is 1 in column 1. I would want to investigate that further. What other info on the area do you need? Which version is this btw?
a
I was basically looking for a distinctification so I knew if it was the first or the second element, but for my situation the rowspawn would've been enough already, but I can imagine it could be nice to have some area information when rendering the element (for example the col/rowspan, the amount of items maybe even?
13.3.0
Hmm when checking it again it makes somewhat sense An area correctly has rowspan 2 (or w/e how high you make it) when editing it in the datatype configuration for that area An item/element always seems to be rowspan 1, as you can always add more then 1 item in an area (unless you disallow this) There is no configuration for an item to say, 'this is 2 rows in height' Best case you could only have 2 rowspans of height of elements in an area that has rowspan 2 So either 1 big element, or 2 small ones, or perhaps this is something that was there but replaced by the 'number of blocks in an area' ?
Ow wait theres an option for it, damn..
And then it correctly gets set
d
That's a start 🙂
a
So for my use case, I can now make it work 😛
Copy code
csharp
if (Model.ColumnSpan == 6)
{
  if(Model.RowSpan == 2){
      // Render big one
   }
      else
   {
      // Render rectangle one
    }
  }
  else
  {
    // render small ones
}
Now the same element can be draggable to be one or 2 rowspawns.. But if I want to make it editor~~safe~~ friendly, I need to have item-1 to always have 2, and item-2 to always have one.. So creating a new similar element is the way to go to be foolproof I guess 😄 https://cdn.discordapp.com/attachments/1261676711708463206/1262716170566373418/image.png?ex=66979b93&is=66964a13&hm=a7accc329ac3779372cd017ec5a47e4d60add09d464bade7d01a738ec28eabc4&
Thanks for the help though people 🙂