[Dojo-interest] JsonRestStore updates and $ref lazy refrences

Maulin Shah maulinpshah at gmail.com
Tue Aug 12 17:12:41 UTC 2008


that bug was a brain lapse on my part, but this was part of it. thanks  
for the fix!

(the bug was my code -- in my JsonRestStore subclass I support query  
in the format of

{foo:['a', 'b']}

where 'a' and 'b' are OR'd in the search.

so I had to override querySuperSet, matchesQuery, and isMatch for this  
case. Well, when passing a
string id as the 'query' for clientFetch, it checks querySuperSet,  
which fails in the default querySuperSet. But my over-ridden class  
didn't
fail right, so it caused a cache-hit. Anway, alls well that ends well.

On Aug 12, 2008, at 10:02 AM, Kris Zyp wrote:

>
>> FYI: your id usage is a little tricky -- and is a problem I came
>> across. Technically "id" for /foo/1 is just "1". The JsonRestStore
>> internal id is /foo/1. The $ref though needs to be the full "/bar/
>> 2" (so JsonRestStore knows the 'path' to the associated object), but
>> bar's id can be just "2". Generally JsonRestStore does the right  
>> thing
>> if you supply the full path as the id attribute. The only exception  
>> is
>> if you are using one store to access another store's items. So in  
>> your
>> example above if you use fooStore.fetchItemByIdentity("/bar/2") it
>> will break (this is despite the fact that if you do
>> fooStore.getValue(bar, "quux"), you will indeed get the value you
>> want). You have to use barStore.fetchItemByIdentity("2"), or if you
>> keep id's the way you have them, you can use
>> barStore.fetchItemByIdentity("/bar/2"). I've been meaning to write
>> kris about this behavior, and see if there might be some clever
>> solution. If there is, he certainly will find it!
>
> Good catch Maulin, getIdentity and fetchItemByIdentity really need  
> to be
> symmetrical, and since getIdentity can return an absolute id when an  
> item
> from a different store is provided, fetchItemByIdentity should  
> handle this
> as well. I just checked in a fix for that. fetchItemByIdentity  
> should now be
> able to relative ids ("2") or absolute ids ("/bar/2") so now you can  
> do
> fooStore.fetchItemByIdentity("/bar/2"). BTW, is that what this bug  
> is about
> http://trac.dojotoolkit.org/ticket/7374#comment:3?
>
> Thanks,
> Kris
>
> _______________________________________________
> FAQ: http://dojotoolkit.org/support/faq
> Book: http://dojotoolkit.org/docs/book
> Forums: http://dojotoolkit.org/forum
> Dojo-interest at dojotoolkit.org
> http://turtle.dojotoolkit.org/mailman/listinfo/dojo-interest



More information about the Dojo-interest mailing list