[dojo-contributors] ItemFileReadStore question -- Anyone see why this wouldnt work? I'm stumpped...

Jared Jurkiewicz jared.jurkiewicz at gmail.com
Fri Sep 12 11:35:24 EDT 2008


fetchItemByIdentity works without having to call _forceLoad().  It
does the same checking fetch() does.   There should have been no
reason to resort to calling _forceLoad().   There are specific unit
tests for the store that call fetchItemByIdentity() as the first call
and they pass without requiring calls to _forceLoad().

-- Jared Jurkiewicz

On Fri, Sep 12, 2008 at 11:20 AM, Tom Trenka <ttrenka at gmail.com> wrote:
> Going off memory, I want to say that in my case it was because the first
> call was fetchByIdentity, and not the fetch methods themselves. But I'd have
> to go digging for it.
> trt
>
> On Fri, Sep 12, 2008 at 10:04 AM, Jared Jurkiewicz
> <jared.jurkiewicz at gmail.com> wrote:
>>
>>  Query doesn't call _forceLoad().   Query checks the state to see if
>> data has yet been populated and loads it if it has not.  _forceLoad()
>> was introducted to deal with things like newItem(), and the like.
>> Given you cannot officially have references to any items without
>> invoking a query in the first place, I don't see where the problem is.
>>  If you're going to internal structures to get items and bypassing a
>> query, then you're completely violating the dojo.data API to begin
>> with and all bets are off.
>>
>>   What I don't understand is why any of you would need to call
>> _forceLoad() if you're using the dojo.data API by spec.   Can you
>> clarify exactly why you had to resort to it?
>>
>> -- Jared Jurkiewicz.
>>
>>
>>
>> On Thu, Sep 11, 2008 at 4:26 PM, Tom Trenka <ttrenka at gmail.com> wrote:
>> > Jared--
>> > Can you make this really clear somewhere in the documentation?  I ran
>> > into
>> > this exact same issue with a previous client project and did what Karl
>> > did:
>> > resort to _forceLoad (just remembering this now).
>> > (I also seem to remember a query *not* doing that but this was against
>> > 0.9
>> > IIRC.)
>> > regards,
>> > trt
>> >
>> > On Thu, Sep 11, 2008 at 2:37 PM, Jared Jurkiewicz
>> > <jared.jurkiewicz at gmail.com> wrote:
>> >>
>> >>     As with data obtained from URLs, the data objects are not parsed
>> >> or inserted into any arras until the first actual query via fetch(),
>> >> fetchItemByIdentity, etc.   Effectively it doesn't waste time parsing
>> >> anything until it actually needs to.
>> >>
>> >> -- Jared
>> >>
>> >>
>> >> On Thu, Sep 11, 2008 at 3:14 PM, Karl Tiedt <ktiedt at gmail.com> wrote:
>> >> > Sorry for the wasted email everyone, I figured it out finally...
>> >> >
>> >> > when loading data from a JSON var... _forceLoad() must be called (if
>> >> > not
>> >> > connected to a widget) is what I've found... otherwise the widget
>> >> > does
>> >> > it
>> >> > for you. I was merely trying to validate my data format... any
>> >> > attempt
>> >> > to
>> >> > access data (fetch or query) sounds like it should force the laod as
>> >> > well as
>> >> > far as that goes... was just a tad disconcerting to keep seeing 0
>> >> > length
>> >> > data arrays coming up :/
>> >> >
>> >> > -Karl Tiedt
>> >> >
>> >> >
>> >> > On Thu, Sep 11, 2008 at 1:50 PM, Karl Tiedt <ktiedt at gmail.com> wrote:
>> >> >>
>> >> >> I have the following JSON:
>> >> >>
>> >> >> {
>> >> >>      "identifier": "uuid",
>> >> >>      "items": [
>> >> >>              {
>> >> >>                      "Power State": "On",
>> >> >>                      "Boot Time":
>> >> >> "2008-08-30T23:50:06.028558-04:00",
>> >> >>
>> >> >>
>> >> >>                      "Host Name": "poweredOn",
>> >> >>                      "IP Address":
>> >> >> "2008-08-30T23:50:06.028558-04:00",
>> >> >>                      "Name": "New Virtual Machine",
>> >> >>                      "Operating System": "Microsoft Windows Server
>> >> >> 2003, Standard Edition
>> >> >> (32-bit)",
>> >> >>
>> >> >>
>> >> >>                      "uuid": "564dd5b0-b887-4041-bcfe-4896e6040547"
>> >> >>              },
>> >> >>              {
>> >> >>                      "Power State": "On",
>> >> >>                      "Boot Time": "2008-08-20T02:15:57.63562-04:00",
>> >> >>                      "Host Name": "sergey-8227caed.",
>> >> >>
>> >> >>
>> >> >>                      "IP Address": "192.168.1.51",
>> >> >>                      "Name": "Foo",
>> >> >>                      "Operating System": "Microsoft Windows XP
>> >> >> Professional (32-bit)",
>> >> >>
>> >> >>
>> >> >>                      "uuid": "564d36e4-6cea-e0e8-5216-3766ef2a3bd0"
>> >> >>              }
>> >> >>      ],
>> >> >>      "label":
>> >> >>
>> >> >> And I am trying to create a store from it...
>> >> >> test = new dojo.data.ItemFileReadStore({'data': varName});
>> >> >>
>> >> >> and it always comes back with 0 items... I've tried adding 'label':
>> >> >> 'Name'
>> >> >> and 'identifier':'uuid' to the JSON object but... neither made a
>> >> >> difference... I've tried replacing the spaces in the property names
>> >> >> and
>> >> >> removing the -'s from the uuid....
>> >> >>
>> >> >> Stumped :(
>> >> >>
>> >> >> -Karl Tiedt
>> >> >
>> >> >
>> >> > _______________________________________________
>> >> > dojo-contributors mailing list
>> >> > dojo-contributors at dojotoolkit.org
>> >> > http://turtle.dojotoolkit.org/mailman/listinfo/dojo-contributors
>> >> >
>> >> >
>> >> _______________________________________________
>> >> dojo-contributors mailing list
>> >> dojo-contributors at dojotoolkit.org
>> >> http://turtle.dojotoolkit.org/mailman/listinfo/dojo-contributors
>> >
>> >
>> > _______________________________________________
>> > dojo-contributors mailing list
>> > dojo-contributors at dojotoolkit.org
>> > http://turtle.dojotoolkit.org/mailman/listinfo/dojo-contributors
>> >
>> >
>> _______________________________________________
>> dojo-contributors mailing list
>> dojo-contributors at dojotoolkit.org
>> http://turtle.dojotoolkit.org/mailman/listinfo/dojo-contributors
>
>
> _______________________________________________
> dojo-contributors mailing list
> dojo-contributors at dojotoolkit.org
> http://turtle.dojotoolkit.org/mailman/listinfo/dojo-contributors
>
>



More information about the dojo-contributors mailing list