I've just tested your solution and it worked for me indeed. Thank you very much for your time! I bet this will help other developers too.
About the ugliness, I don't know if this is the case, but couldn't you include in the specification that the Count should be available for data coming from a HttpRequest? I guess that like it is now, if you want to create a message like "You've received 99 gifts", you would need to create a repeated element, test if the current item is the top one and then finally you'd be able to use the Count. Outside the the repeating element you'd need to create another "if" like yours solution to show a message if no items exist. Regards, Juarez PS: I've watched all OpenSocial IO events on youtube. You Googlers rock. Keep up the good work. ;-) On Jun 16, 9:31 pm, Arne Roomann-Kurrik <api.kur...@google.com> wrote: > Sorry for taking a bit of time on this, I wound up writing my own example to > test this behavior. Turns out, it's possible by checking for the presence > of the first item in the list: > > <span if="${gifts.content[0] == null}">No items!</span> > <span if="${gifts.content[0] != null}">Items!</span> > > Feels ugly, but it works on orkut :) > > ~Arne > > On Fri, Jun 12, 2009 at 6:17 PM, Juarez <jbo...@gmail.com> wrote: > > > Thanks again for your prompt reply. > > > You're right: Context.Count works inside the repeating element, but it > > does not help in the cases that do not have entries. > > > I've tried <span if="${!gifts.content}">...</span>, but the message > > is not shown. > > > ${gifts.content} alone is evalued to [] > > ${!gifts.content} returns nothing > > ${gifts.content == []} returns nothing > > > Would you have any other suggestions? :-) > > > Juarez > > > On Jun 12, 7:37 pm, Arne Roomann-Kurrik <api.kur...@google.com> wrote: > > > Sorry, I misunderstood where you were having the problem. Normally > > > you would use Context.Count inside of a repeating element, but I don't > > > think that's going to work for the case where there are no entries in > > > the list that you're repeating over. What happens if you do <span > > > if="${!gifts.content}">...</span> ? > > > > ~Arne > > > > On Jun 12, 3:21 pm, Juarez <jbo...@gmail.com> wrote: > > > > > Hi Arne, > > > > > Thank you for your reply, but this did not work for me. > > > > > Actually I am using <li repeat="${gifts.content}"> because I am > > > > getting the data from a <os:HttpRequest> > > > > > Since ${gifts} results in {"content":[],"headers":{"content-type": > > > > ["text/html; charset=utf-8"]},"status":200}, I've tried also $ > > > > {gifts.content.Count} and ${gifts.content.lenght} with no success in > > > > Orkut's sandbox. > > > > > Am I doing something wrong? I can include the number of objects in the > > > > JSON in server side, but wouldn't it be better if Count were available > > > > for those getting data from 3rd party APIs? > > > > > Regards, Juarez > > > > > On Jun 11, 8:38 pm, Arne Roomann-Kurrik <api.kur...@google.com> wrote: > > > > > > I've gotten this to work successfully: > > > > > > <span if="${gifts.Count == 0}">I received no gifts yet!</span> > > > > > > Hope that helps! > > > > > ~Arne > > > > > > On Jun 11, 7:32 am, Juarez <jbo...@gmail.com> wrote: > > > > > > > Hi, I've created a repeated element like this: > > > > > > > <ul> > > > > > > <li repeat="${gifts}"> > > > > > > ${Cur.name} > > > > > > </li> > > > > > > </ul> > > > > > > > The problem is that I want to display a special message if no items > > > > > > are found. I've tried the following, but it does not work. > > > > > > > <os:If condition="${gifts.Count == 0}"> > > > > > > I received no gifts yet! > > > > > > </os:If> > > > > > > > Can anybody help me? Thanks! > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "OpenSocial Application Development" group. To post to this group, send email to opensocial-api@googlegroups.com To unsubscribe from this group, send email to opensocial-api+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/opensocial-api?hl=en -~----------~----~----~----~------~----~------~--~---