I'm currently using uSiteBuilder and am trying to convert the xml ouput to a strongly typed widget object that contains rows and columns (using ICustomTypeConvertor) - with the aim of allowing me to interate through the widgets like:
foreach (var row in Widgets.Rows) { forech(var col in row.Columns) { } }
I think I'll download the source and have a play :)
The purpose of the output value is not to be grid like at all because it represents more of an abstract concept of the layout of the front end rather than anything, so it's only the final cell ids that are referenced. That said, if you want to be able to loop it in that way, you could do something like give you table cells ids like r1_c1, r1_c2 etc, and then build up a compound key in your loop logic to reference the cell you are after.
My thought was that my components/widgets will be displayed on the frontend in the same rows/cols that they are layed out in the widget grid - hence thinking of just looping through them.
My widgets class currently contains a collection of nodes so I guess I'm trying to avoid something like:
Sure, but that doesn't work when you start to do fancy tabular layouts that with merged cells as it's not longer a true grid, so I don't think it would help much. Like I say, I think the naming of the id fields gives you the flexibility of what you are after, without forcing the package down a particular path, so I'd be tempted to just reccommend that technique.
Ah, I guess so yeah. As it stands I'm looking at it from a v simple tabular layout - a row with 1 widget, another row with 3, a further with 2 etc. I'm not taking sidebars / row-spans into account. I'll have a look at approaching it as you suggested.
Identifying widget 'rows' in xml/json output
Been using this a bit lately and I think it'd be v cool if it was possible to identify rows as well as columns in the output xml/json.
Maybe something like:
<WidgetGrid>
<row1>
<col1><nodeId>1048</nodeId></col1>
</row1>
<row2>
<col1><nodeId>1049</nodeId></col1>
</row2>
</WidgetGrid>
I'm currently using uSiteBuilder and am trying to convert the xml ouput to a strongly typed widget object that contains rows and columns (using ICustomTypeConvertor) - with the aim of allowing me to interate through the widgets like:
foreach (var row in Widgets.Rows) { forech(var col in row.Columns) { } }
I think I'll download the source and have a play :)
Hey Chris,
The purpose of the output value is not to be grid like at all because it represents more of an abstract concept of the layout of the front end rather than anything, so it's only the final cell ids that are referenced. That said, if you want to be able to loop it in that way, you could do something like give you table cells ids like r1_c1, r1_c2 etc, and then build up a compound key in your loop logic to reference the cell you are after.
Cheers
Matt
Cheers for your reply Matt
My thought was that my components/widgets will be displayed on the frontend in the same rows/cols that they are layed out in the widget grid - hence thinking of just looping through them.
My widgets class currently contains a collection of nodes so I guess I'm trying to avoid something like:
<div class="col-span">
<div class="col"><%= Widgets.Nodes[0].Title %></div>
<div class="col"><%= Widgets.Nodes[1].Title %></div>
</div>
<div class="col-span">
<div class="col"><%= Widgets.Nodes[2].Title %></div>
<div class="col"><%= Widgets.Nodes[3].Title %></div>
</div>
Forgot to add, it's the widgets that determine the col spans and cols, not the other way round (if that makes sense?)
Hey Chris,
Sure, but that doesn't work when you start to do fancy tabular layouts that with merged cells as it's not longer a true grid, so I don't think it would help much. Like I say, I think the naming of the id fields gives you the flexibility of what you are after, without forcing the package down a particular path, so I'd be tempted to just reccommend that technique.
Glad that you find it usefull though.
Cheers
Matt
Ah, I guess so yeah. As it stands I'm looking at it from a v simple tabular layout - a row with 1 widget, another row with 3, a further with 2 etc. I'm not taking sidebars / row-spans into account. I'll have a look at approaching it as you suggested.
Cheers for your help.
No problem,
Let me know how you get on.
Cheers
Matt
is working on a reply...