Copied to clipboard

Flag this post as spam?

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


  • Chris Parkinson 39 posts 73 karma points
    Oct 17, 2012 @ 14:49
    Chris Parkinson
    0

    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 :)

  • Matt Brailsford 4125 posts 22223 karma points MVP 9x c-trib
    Oct 17, 2012 @ 15:01
    Matt Brailsford
    0

    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

  • Chris Parkinson 39 posts 73 karma points
    Oct 17, 2012 @ 15:32
    Chris Parkinson
    0

    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> 

  • Chris Parkinson 39 posts 73 karma points
    Oct 17, 2012 @ 15:34
    Chris Parkinson
    0

    Forgot to add, it's the widgets that determine the col spans and cols, not the other way round (if that makes sense?)

  • Matt Brailsford 4125 posts 22223 karma points MVP 9x c-trib
    Oct 17, 2012 @ 15:35
    Matt Brailsford
    0

    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

  • Chris Parkinson 39 posts 73 karma points
    Oct 17, 2012 @ 15:39
    Chris Parkinson
    0

    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.

  • Matt Brailsford 4125 posts 22223 karma points MVP 9x c-trib
    Oct 17, 2012 @ 15:40
    Matt Brailsford
    0

    No problem,

    Let me know how you get on.

    Cheers

    Matt

Please Sign in or register to post replies

Write your reply to:

Draft