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 -~----------~----~----~----~------~----~------~--~---