CJ and UI Layouts

29 views
Skip to first unread message

Christopher Reising

unread,
Mar 18, 2016, 11:39:30 AM3/18/16
to Collection+JSON

I am working on a project that has started to incorporate CJ into our API. You can think of it as an IoT type of project. The challenge we are having right now has to do with how we are presenting this data on the UI. We want to able to indicate which UI layout should be used to present the data.  For example, when you visit link A, we may want to use a certain layout to group certain attributes together, while link B might use a different arrangement.  We think the API needs to provide some indication regarding what type of layout should be used when and where. Basically, it needs to provide some sort of context in addition to the data. Our initial thought was we can add a field at the collection layout to say which UI layout should be used (our client would contain “stock” layouts) for the data being passed to the client. For clients by others, they would simply ignore this field.

 

My question to the group is has anyone had to deal with this before? Not only does our data need to be generic, but we want to provide a unique experiences based on certain conditions. Just thought I would throw is out there to see if the community had any insight on this.

Sorry if this question is ridiculous.

mca

unread,
Mar 18, 2016, 12:22:53 PM3/18/16
to collect...@googlegroups.com
CR:

i've been doing the following to help me "style" the rendering of Cj resposnes

1) in the case of HTML rendering, i include a "stylesheet" URL in the links collection and train the client to look for (and load) the stylesheet CSS. this does quite well, esp for SPA-style apps.

2) in the case of native app/desktop rendering, i include a "type" URL in the links collection and train the client app to use the URL as a pointer to a custom layout configuration file and train the client to know how to use that config info to render the data.

both these options allow clients to make their own decisions on how to handle layout (e.g. even IGNORE the service and do it themselves) and you can even include both "stylesheet" and "type" links in each response so that the same service representation can be handled by each platform. 

i haven't done it yet, but i suspect you can even send *multiple* options for each (stylesheet and type) and let the client sort out the one's they prefer to use.

hope this helps and would love to hear how your project is going and what you end up doing on this item.

cheers.



--
You received this message because you are subscribed to the Google Groups "Collection+JSON" group.
To unsubscribe from this group and stop receiving emails from it, send an email to collectionjso...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Christopher Reising

unread,
Mar 19, 2016, 12:11:01 AM3/19/16
to Collection+JSON
Thanks! This is close to what we were thinking, so that is reassuring. Will keep you posted.
Reply all
Reply to author
Forward
0 new messages