ItemFileReadStore problem/exception

View: New views
9 Messages — Rating Filter:   Alert me  

ItemFileReadStore problem/exception

by DHall :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I have two related arrays of information, stored in memory. The first list is array of event type objects, the second an array of event subtype objects, with info that links to to their parent event type.

I read them both into ItemFileReadStores.

I link the event type ItemFileReadStore to a FilteringSelect. The onchange for that filtering select needs to produce a ItemFileReadStore that can be linked to a second filtering select, based on a subset of the event subtype objects.

Basically, the below accesses the value of the event type, then fetches the objects that match that value from the subtype data store. (eventScheduledSubTypeDataStore is a globally defined object that I hope to use over and over.)

The below works fine the FIRST time it runs. It never works again, instead producing:
[Exception... "'Error: dojo.data.ItemFileReadStore: Invalid item argument.' when calling method: [nsIDOMEventListener::handleEvent]" nsresult: "0x8057001c (NS_ERROR_XPC_JS_THREW_JS_OBJECT)" location: "<unknown>" data: no], throwing this error on the var request . . . etc line when stepping through with firebug.

I look at eventScheduledSubTypeDataStore in firebug and it appears unchanged: all the objects have their VALUE and DESC fields correctly associated.

Does anyone have (a) any suggestion on what might be wrong or (b) a suggestion on a better way to do this? Thanks.

function  subtypeCheck (input, viewerId){
        var form = dijit.byId("eventForm_"+ viewerId);
        var type = form.attr('value').EVENT_TYPE;
        var value = input.attr("value");
        if(type.toLowerCase() == "scheduled"){
                var subInput = dijit.byId("eventSubtypeValue_" + viewerId);
                var request = eventScheduledSubTypeDataStore.fetch({query: {'DESC': value},
                        queryOptions: {ignoreCase: true},
                        onComplete: updateValues,
                        onError: function () {log("error with subtypeCheck!");}});
                subInput.store = arrayToDataStore(request.items, "VALUE", "VALUE");
                subInput.store.fetch();
        }
       
}

var updateValues = function(items, request){
        request.items = items;
}

function arrayToDataStore(array, id, lab){
        var dataItems = {
                identifier: id,
                'label': lab,
                items: array
        };
        return dataStore = new dojo.data.ItemFileReadStore({data: dataItems, clearOnClose: true});
}




Re: ItemFileReadStore problem/exception

by lukess :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I am also facing the same problem... Don't know if this is the known bug or any thing else...
DHall wrote:
I have two related arrays of information, stored in memory. The first list is array of event type objects, the second an array of event subtype objects, with info that links to to their parent event type.

I read them both into ItemFileReadStores.

I link the event type ItemFileReadStore to a FilteringSelect. The onchange for that filtering select needs to produce a ItemFileReadStore that can be linked to a second filtering select, based on a subset of the event subtype objects.

Basically, the below accesses the value of the event type, then fetches the objects that match that value from the subtype data store. (eventScheduledSubTypeDataStore is a globally defined object that I hope to use over and over.)

The below works fine the FIRST time it runs. It never works again, instead producing:
[Exception... "'Error: dojo.data.ItemFileReadStore: Invalid item argument.' when calling method: [nsIDOMEventListener::handleEvent]" nsresult: "0x8057001c (NS_ERROR_XPC_JS_THREW_JS_OBJECT)" location: "<unknown>" data: no], throwing this error on the var request . . . etc line when stepping through with firebug.

I look at eventScheduledSubTypeDataStore in firebug and it appears unchanged: all the objects have their VALUE and DESC fields correctly associated.

Does anyone have (a) any suggestion on what might be wrong or (b) a suggestion on a better way to do this? Thanks.

function  subtypeCheck (input, viewerId){
        var form = dijit.byId("eventForm_"+ viewerId);
        var type = form.attr('value').EVENT_TYPE;
        var value = input.attr("value");
        if(type.toLowerCase() == "scheduled"){
                var subInput = dijit.byId("eventSubtypeValue_" + viewerId);
                var request = eventScheduledSubTypeDataStore.fetch({query: {'DESC': value},
                        queryOptions: {ignoreCase: true},
                        onComplete: updateValues,
                        onError: function () {log("error with subtypeCheck!");}});
                subInput.store = arrayToDataStore(request.items, "VALUE", "VALUE");
                subInput.store.fetch();
        }
       
}

var updateValues = function(items, request){
        request.items = items;
}

function arrayToDataStore(array, id, lab){
        var dataItems = {
                identifier: id,
                'label': lab,
                items: array
        };
        return dataStore = new dojo.data.ItemFileReadStore({data: dataItems, clearOnClose: true});
}



Re: ItemFileReadStore problem/exception

by lukess :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi all,

  I joined this group because a friend of mine told me this is the most active group for dojo people, i asked a problem and still haven't found a solution..

and more specifically the error says:

dojo.data.ItemFileReadStore: Invalid item argument.
    (57 out of range 16)



I am also facing the same problem... Don't know if this is the known bug or any thing else...
DHall wrote:
I have two related arrays of information, stored in memory. The first list is array of event type objects, the second an array of event subtype objects, with info that links to to their parent event type.

I read them both into ItemFileReadStores.

I link the event type ItemFileReadStore to a FilteringSelect. The onchange for that filtering select needs to produce a ItemFileReadStore that can be linked to a second filtering select, based on a subset of the event subtype objects.

Basically, the below accesses the value of the event type, then fetches the objects that match that value from the subtype data store. (eventScheduledSubTypeDataStore is a globally defined object that I hope to use over and over.)

The below works fine the FIRST time it runs. It never works again, instead producing:
[Exception... "'Error: dojo.data.ItemFileReadStore: Invalid item argument.' when calling method: [nsIDOMEventListener::handleEvent]" nsresult: "0x8057001c (NS_ERROR_XPC_JS_THREW_JS_OBJECT)" location: "<unknown>" data: no], throwing this error on the var request . . . etc line when stepping through with firebug.

I look at eventScheduledSubTypeDataStore in firebug and it appears unchanged: all the objects have their VALUE and DESC fields correctly associated.

Does anyone have (a) any suggestion on what might be wrong or (b) a suggestion on a better way to do this? Thanks.

function  subtypeCheck (input, viewerId){
        var form = dijit.byId("eventForm_"+ viewerId);
        var type = form.attr('value').EVENT_TYPE;
        var value = input.attr("value");
        if(type.toLowerCase() == "scheduled"){
                var subInput = dijit.byId("eventSubtypeValue_" + viewerId);
                var request = eventScheduledSubTypeDataStore.fetch({query: {'DESC': value},
                        queryOptions: {ignoreCase: true},
                        onComplete: updateValues,
                        onError: function () {log("error with subtypeCheck!");}});
                subInput.store = arrayToDataStore(request.items, "VALUE", "VALUE");
                subInput.store.fetch();
        }
       
}

var updateValues = function(items, request){
        request.items = items;
}

function arrayToDataStore(array, id, lab){
        var dataItems = {
                identifier: id,
                'label': lab,
                items: array
        };
        return dataStore = new dojo.data.ItemFileReadStore({data: dataItems, clearOnClose: true});
}




Re: ItemFileReadStore problem/exception

by lukess :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi, here is my samplecode:

var sampleStore1;
var sampleStore2;

//somevar1 has the data which is kind of linked

var dropdown1 = new dijit.form.FilteringSelect({id:'t1', autoComplete:false},domFieldObj);
storeData = eval(sampleStore1);

var store = new dojo.data.ItemFileReadStore({data: storeData});
dropdown1.store = store;

var dropdown2 = new dijit.form.FilteringSelect({id:'t2', autoComplete:false},domFieldObj);
storeData1 = eval(sampleStore2);

var store1 = new dojo.data.ItemFileReadStore({data: storeData1});
dropdown2.store = store1;

var dropdown3 = new dijit.form.FilteringSelect({id:'t3', autoComplete:false},domFieldObj);
dropdown3.store = store2;

{......}
and then on the onclick event of dropdown1 i have function

function changetQuery(id)
{
        if (id && id != '')
        {
                var vfpQuery = {fid:id};
                dijit.byId("dropdown2").setDisabled(false);
                dijit.byId("dropdown3").setDisabled(false);
                dijit.byId("dropdown2").query = vfpQuery;
                dijit.byId("dropdown3").query = vfpQuery;
        }

}

for the first time this works fine but once i try to click on dropdown2 it throws the error, but not for the dropdown3.....

don't know what's going wrong....


Hi all,

  I joined this group because a friend of mine told me this is the most active group for dojo people, i asked a problem and still haven't found a solution..

and more specifically the error says:

dojo.data.ItemFileReadStore: Invalid item argument.
    (57 out of range 16)


lukess wrote:
I am also facing the same problem... Don't know if this is the known bug or any thing else...
DHall wrote:
I have two related arrays of information, stored in memory. The first list is array of event type objects, the second an array of event subtype objects, with info that links to to their parent event type.

I read them both into ItemFileReadStores.

I link the event type ItemFileReadStore to a FilteringSelect. The onchange for that filtering select needs to produce a ItemFileReadStore that can be linked to a second filtering select, based on a subset of the event subtype objects.

Basically, the below accesses the value of the event type, then fetches the objects that match that value from the subtype data store. (eventScheduledSubTypeDataStore is a globally defined object that I hope to use over and over.)

The below works fine the FIRST time it runs. It never works again, instead producing:
[Exception... "'Error: dojo.data.ItemFileReadStore: Invalid item argument.' when calling method: [nsIDOMEventListener::handleEvent]" nsresult: "0x8057001c (NS_ERROR_XPC_JS_THREW_JS_OBJECT)" location: "<unknown>" data: no], throwing this error on the var request . . . etc line when stepping through with firebug.

I look at eventScheduledSubTypeDataStore in firebug and it appears unchanged: all the objects have their VALUE and DESC fields correctly associated.

Does anyone have (a) any suggestion on what might be wrong or (b) a suggestion on a better way to do this? Thanks.

function  subtypeCheck (input, viewerId){
        var form = dijit.byId("eventForm_"+ viewerId);
        var type = form.attr('value').EVENT_TYPE;
        var value = input.attr("value");
        if(type.toLowerCase() == "scheduled"){
                var subInput = dijit.byId("eventSubtypeValue_" + viewerId);
                var request = eventScheduledSubTypeDataStore.fetch({query: {'DESC': value},
                        queryOptions: {ignoreCase: true},
                        onComplete: updateValues,
                        onError: function () {log("error with subtypeCheck!");}});
                subInput.store = arrayToDataStore(request.items, "VALUE", "VALUE");
                subInput.store.fetch();
        }
       
}

var updateValues = function(items, request){
        request.items = items;
}

function arrayToDataStore(array, id, lab){
        var dataItems = {
                identifier: id,
                'label': lab,
                items: array
        };
        return dataStore = new dojo.data.ItemFileReadStore({data: dataItems, clearOnClose: true});
}



Re: ItemFileReadStore problem/exception

by lukess :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

In my last i had a typo


function changetQuery(id)
{
        if (id && id != '')
        {
                var vfpQuery = {fid:id};
                dijit.byId("t2").setDisabled(false);
                dijit.byId("t3").setDisabled(false);
                dijit.byId("t2").query = vfpQuery;
                dijit.byId("t3").query = vfpQuery;
        }

}



Hi, here is my samplecode:

var sampleStore1;
var sampleStore2;

//somevar1 has the data which is kind of linked

var dropdown1 = new dijit.form.FilteringSelect({id:'t1', autoComplete:false},domFieldObj);
storeData = eval(sampleStore1);

var store = new dojo.data.ItemFileReadStore({data: storeData});
dropdown1.store = store;

var dropdown2 = new dijit.form.FilteringSelect({id:'t2', autoComplete:false},domFieldObj);
storeData1 = eval(sampleStore2);

var store1 = new dojo.data.ItemFileReadStore({data: storeData1});
dropdown2.store = store1;

var dropdown3 = new dijit.form.FilteringSelect({id:'t3', autoComplete:false},domFieldObj);
dropdown3.store = store2;

{......}
and then on the onclick event of dropdown1 i have function

function changetQuery(id)
{
        if (id && id != '')
        {
                var vfpQuery = {fid:id};
                dijit.byId("dropdown2").setDisabled(false);
                dijit.byId("dropdown3").setDisabled(false);
                dijit.byId("dropdown2").query = vfpQuery;
                dijit.byId("dropdown3").query = vfpQuery;
        }

}

for the first time this works fine but once i try to click on dropdown2 it throws the error, but not for the dropdown3.....

don't know what's going wrong....


Hi all,

  I joined this group because a friend of mine told me this is the most active group for dojo people, i asked a problem and still haven't found a solution..

and more specifically the error says:

dojo.data.ItemFileReadStore: Invalid item argument.
    (57 out of range 16)


lukess wrote:
I am also facing the same problem... Don't know if this is the known bug or any thing else...
DHall wrote:
I have two related arrays of information, stored in memory. The first list is array of event type objects, the second an array of event subtype objects, with info that links to to their parent event type.

I read them both into ItemFileReadStores.

I link the event type ItemFileReadStore to a FilteringSelect. The onchange for that filtering select needs to produce a ItemFileReadStore that can be linked to a second filtering select, based on a subset of the event subtype objects.

Basically, the below accesses the value of the event type, then fetches the objects that match that value from the subtype data store. (eventScheduledSubTypeDataStore is a globally defined object that I hope to use over and over.)

The below works fine the FIRST time it runs. It never works again, instead producing:
[Exception... "'Error: dojo.data.ItemFileReadStore: Invalid item argument.' when calling method: [nsIDOMEventListener::handleEvent]" nsresult: "0x8057001c (NS_ERROR_XPC_JS_THREW_JS_OBJECT)" location: "<unknown>" data: no], throwing this error on the var request . . . etc line when stepping through with firebug.

I look at eventScheduledSubTypeDataStore in firebug and it appears unchanged: all the objects have their VALUE and DESC fields correctly associated.

Does anyone have (a) any suggestion on what might be wrong or (b) a suggestion on a better way to do this? Thanks.

function  subtypeCheck (input, viewerId){
        var form = dijit.byId("eventForm_"+ viewerId);
        var type = form.attr('value').EVENT_TYPE;
        var value = input.attr("value");
        if(type.toLowerCase() == "scheduled"){
                var subInput = dijit.byId("eventSubtypeValue_" + viewerId);
                var request = eventScheduledSubTypeDataStore.fetch({query: {'DESC': value},
                        queryOptions: {ignoreCase: true},
                        onComplete: updateValues,
                        onError: function () {log("error with subtypeCheck!");}});
                subInput.store = arrayToDataStore(request.items, "VALUE", "VALUE");
                subInput.store.fetch();
        }
       
}

var updateValues = function(items, request){
        request.items = items;
}

function arrayToDataStore(array, id, lab){
        var dataItems = {
                identifier: id,
                'label': lab,
                items: array
        };
        return dataStore = new dojo.data.ItemFileReadStore({data: dataItems, clearOnClose: true});
}




Re: ItemFileReadStore problem/exception

by lukess :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi,

   I found a solution to my problem but seems to me a bug in dojo refrencing.....

so now what i did is, from my backend i am sending three data stores out of which two have exactly the same values. and now in the front end instead of


var store1 = new dojo.data.ItemFileReadStore({data: storeData1});
dropdown2.store = store1;

var dropdown3 = new dijit.form.FilteringSelect({id:'t3', autoComplete:false},domFieldObj);
dropdown3.store = store1;


i am creating identical store and refrencing it.

var dropdown3 = new dijit.form.FilteringSelect({id:'t3', autoComplete:false},domFieldObj);
var store2 = new dojo.data.ItemFileReadStore({data: storeData2});
dropdown3.store = store2;


Thanks anyways....




In my last i had a typo


function changetQuery(id)
{
        if (id && id != '')
        {
                var vfpQuery = {fid:id};
                dijit.byId("t2").setDisabled(false);
                dijit.byId("t3").setDisabled(false);
                dijit.byId("t2").query = vfpQuery;
                dijit.byId("t3").query = vfpQuery;
        }

}



Hi, here is my samplecode:

var sampleStore1;
var sampleStore2;

//somevar1 has the data which is kind of linked

var dropdown1 = new dijit.form.FilteringSelect({id:'t1', autoComplete:false},domFieldObj);
storeData = eval(sampleStore1);

var store = new dojo.data.ItemFileReadStore({data: storeData});
dropdown1.store = store;

var dropdown2 = new dijit.form.FilteringSelect({id:'t2', autoComplete:false},domFieldObj);
storeData1 = eval(sampleStore2);

var store1 = new dojo.data.ItemFileReadStore({data: storeData1});
dropdown2.store = store1;

var dropdown3 = new dijit.form.FilteringSelect({id:'t3', autoComplete:false},domFieldObj);
dropdown3.store = store1;

{......}
and then on the onclick event of dropdown1 i have function

function changetQuery(id)
{
        if (id && id != '')
        {
                var vfpQuery = {fid:id};
                dijit.byId("dropdown2").setDisabled(false);
                dijit.byId("dropdown3").setDisabled(false);
                dijit.byId("dropdown2").query = vfpQuery;
                dijit.byId("dropdown3").query = vfpQuery;
        }

}

for the first time this works fine but once i try to click on dropdown2 it throws the error, but not for the dropdown3.....

don't know what's going wrong....

lukess wrote:
Hi all,

  I joined this group because a friend of mine told me this is the most active group for dojo people, i asked a problem and still haven't found a solution..

and more specifically the error says:

dojo.data.ItemFileReadStore: Invalid item argument.
    (57 out of range 16)


lukess wrote:
I am also facing the same problem... Don't know if this is the known bug or any thing else...
DHall wrote:
I have two related arrays of information, stored in memory. The first list is array of event type objects, the second an array of event subtype objects, with info that links to to their parent event type.

I read them both into ItemFileReadStores.

I link the event type ItemFileReadStore to a FilteringSelect. The onchange for that filtering select needs to produce a ItemFileReadStore that can be linked to a second filtering select, based on a subset of the event subtype objects.

Basically, the below accesses the value of the event type, then fetches the objects that match that value from the subtype data store. (eventScheduledSubTypeDataStore is a globally defined object that I hope to use over and over.)

The below works fine the FIRST time it runs. It never works again, instead producing:
[Exception... "'Error: dojo.data.ItemFileReadStore: Invalid item argument.' when calling method: [nsIDOMEventListener::handleEvent]" nsresult: "0x8057001c (NS_ERROR_XPC_JS_THREW_JS_OBJECT)" location: "<unknown>" data: no], throwing this error on the var request . . . etc line when stepping through with firebug.

I look at eventScheduledSubTypeDataStore in firebug and it appears unchanged: all the objects have their VALUE and DESC fields correctly associated.

Does anyone have (a) any suggestion on what might be wrong or (b) a suggestion on a better way to do this? Thanks.

function  subtypeCheck (input, viewerId){
        var form = dijit.byId("eventForm_"+ viewerId);
        var type = form.attr('value').EVENT_TYPE;
        var value = input.attr("value");
        if(type.toLowerCase() == "scheduled"){
                var subInput = dijit.byId("eventSubtypeValue_" + viewerId);
                var request = eventScheduledSubTypeDataStore.fetch({query: {'DESC': value},
                        queryOptions: {ignoreCase: true},
                        onComplete: updateValues,
                        onError: function () {log("error with subtypeCheck!");}});
                subInput.store = arrayToDataStore(request.items, "VALUE", "VALUE");
                subInput.store.fetch();
        }
       
}

var updateValues = function(items, request){
        request.items = items;
}

function arrayToDataStore(array, id, lab){
        var dataItems = {
                identifier: id,
                'label': lab,
                items: array
        };
        return dataStore = new dojo.data.ItemFileReadStore({data: dataItems, clearOnClose: true});
}



Re: ItemFileReadStore problem/exception

by Dustin Machi-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

It sounds to me like you are sharing source objects.  Since objects  
are passed by reference and the ItemFileReadStore then 'takes' over  
the object that gets passed.  You cannot then take that same object  
and pass it off to another store constructor. You would need to clone  
it first.

Dustin

On Jul 30, 2009, at 4:26 PM, lukess wrote:

>
> Hi,
>
>   I found a solution to my problem but seems to me a bug in dojo
> refrencing.....
>
> so now what i did is, from my backend i am sending three data stores  
> out of
> which two have exactly the same values. and now in the front end  
> instead of
>
>
> var store1 = new dojo.data.ItemFileReadStore({data: storeData1});
> dropdown2.store = store1;
>
> var dropdown3 = new dijit.form.FilteringSelect({id:'t3',
> autoComplete:false},domFieldObj);
> dropdown3.store = store1;
>
>
> i am creating identical store and refrencing it.
>
> var dropdown3 = new dijit.form.FilteringSelect({id:'t3',
> autoComplete:false},domFieldObj);
> var store2 = new dojo.data.ItemFileReadStore({data: storeData2});
> dropdown3.store = store2;
>
> Thanks anyways....
>
>
>
>
> lukess wrote:
>>
>> In my last i had a typo
>>
>>
>> function changetQuery(id)
>> {
>> if (id && id != '')
>> {
>> var vfpQuery = {fid:id};
>> dijit.byId("t2").setDisabled(false);
>> dijit.byId("t3").setDisabled(false);
>> dijit.byId("t2").query = vfpQuery;
>> dijit.byId("t3").query = vfpQuery;
>> }
>>
>> }
>>
>>
>>
>> lukess wrote:
>>>
>>> Hi, here is my samplecode:
>>>
>>> var sampleStore1;
>>> var sampleStore2;
>>>
>>> //somevar1 has the data which is kind of linked
>>>
>>> var dropdown1 = new dijit.form.FilteringSelect({id:'t1',
>>> autoComplete:false},domFieldObj);
>>> storeData = eval(sampleStore1);
>>>
>>> var store = new dojo.data.ItemFileReadStore({data: storeData});
>>> dropdown1.store = store;
>>>
>>> var dropdown2 = new dijit.form.FilteringSelect({id:'t2',
>>> autoComplete:false},domFieldObj);
>>> storeData1 = eval(sampleStore2);
>>>
>>> var store1 = new dojo.data.ItemFileReadStore({data: storeData1});
>>> dropdown2.store = store1;
>>>
>>> var dropdown3 = new dijit.form.FilteringSelect({id:'t3',
>>> autoComplete:false},domFieldObj);
>>> dropdown3.store = store1;
>>>
>>> {......}
>>> and then on the onclick event of dropdown1 i have function
>>>
>>> function changetQuery(id)
>>> {
>>> if (id && id != '')
>>> {
>>> var vfpQuery = {fid:id};
>>> dijit.byId("dropdown2").setDisabled(false);
>>> dijit.byId("dropdown3").setDisabled(false);
>>> dijit.byId("dropdown2").query = vfpQuery;
>>> dijit.byId("dropdown3").query = vfpQuery;
>>> }
>>>
>>> }
>>>
>>> for the first time this works fine but once i try to click on  
>>> dropdown2
>>> it throws the error, but not for the dropdown3.....
>>>
>>> don't know what's going wrong....
>>>
>>>
>>> lukess wrote:
>>>>
>>>> Hi all,
>>>>
>>>>  I joined this group because a friend of mine told me this is the  
>>>> most
>>>> active group for dojo people, i asked a problem and still haven't  
>>>> found
>>>> a solution..
>>>>
>>>> and more specifically the error says:
>>>>
>>>> dojo.data.ItemFileReadStore: Invalid item argument.
>>>>    (57 out of range 16)
>>>>
>>>>
>>>>
>>>> lukess wrote:
>>>>>
>>>>> I am also facing the same problem... Don't know if this is the  
>>>>> known
>>>>> bug or any thing else...
>>>>>
>>>>> DHall wrote:
>>>>>>
>>>>>> I have two related arrays of information, stored in memory. The  
>>>>>> first
>>>>>> list is array of event type objects, the second an array of event
>>>>>> subtype objects, with info that links to to their parent event  
>>>>>> type.
>>>>>>
>>>>>> I read them both into ItemFileReadStores.
>>>>>>
>>>>>> I link the event type ItemFileReadStore to a FilteringSelect. The
>>>>>> onchange for that filtering select needs to produce a
>>>>>> ItemFileReadStore that can be linked to a second filtering  
>>>>>> select,
>>>>>> based on a subset of the event subtype objects.
>>>>>>
>>>>>> Basically, the below accesses the value of the event type, then
>>>>>> fetches the objects that match that value from the subtype data  
>>>>>> store.
>>>>>> (eventScheduledSubTypeDataStore is a globally defined object  
>>>>>> that I
>>>>>> hope to use over and over.)
>>>>>>
>>>>>> The below works fine the FIRST time it runs. It never works  
>>>>>> again,
>>>>>> instead producing:
>>>>>> [Exception... "'Error: dojo.data.ItemFileReadStore: Invalid item
>>>>>> argument.' when calling method:  
>>>>>> [nsIDOMEventListener::handleEvent]"
>>>>>> nsresult: "0x8057001c (NS_ERROR_XPC_JS_THREW_JS_OBJECT)"  
>>>>>> location:
>>>>>> "<unknown>" data: no], throwing this error on the var  
>>>>>> request . . .
>>>>>> etc line when stepping through with firebug.
>>>>>>
>>>>>> I look at eventScheduledSubTypeDataStore in firebug and it  
>>>>>> appears
>>>>>> unchanged: all the objects have their VALUE and DESC fields  
>>>>>> correctly
>>>>>> associated.
>>>>>>
>>>>>> Does anyone have (a) any suggestion on what might be wrong or  
>>>>>> (b) a
>>>>>> suggestion on a better way to do this? Thanks.
>>>>>>
>>>>>> function  subtypeCheck (input, viewerId){
>>>>>> var form = dijit.byId("eventForm_"+ viewerId);
>>>>>> var type = form.attr('value').EVENT_TYPE;
>>>>>> var value = input.attr("value");
>>>>>> if(type.toLowerCase() == "scheduled"){
>>>>>> var subInput = dijit.byId("eventSubtypeValue_" + viewerId);
>>>>>> var request = eventScheduledSubTypeDataStore.fetch({query:  
>>>>>> {'DESC':
>>>>>> value},
>>>>>> queryOptions: {ignoreCase: true},
>>>>>> onComplete: updateValues,
>>>>>> onError: function () {log("error with subtypeCheck!");}});
>>>>>> subInput.store = arrayToDataStore(request.items, "VALUE",  
>>>>>> "VALUE");
>>>>>> subInput.store.fetch();
>>>>>> }
>>>>>>
>>>>>> }
>>>>>>
>>>>>> var updateValues = function(items, request){
>>>>>> request.items = items;
>>>>>> }
>>>>>>
>>>>>> function arrayToDataStore(array, id, lab){
>>>>>> var dataItems = {
>>>>>> identifier: id,
>>>>>> 'label': lab,
>>>>>> items: array
>>>>>> };
>>>>>> return dataStore = new dojo.data.ItemFileReadStore({data:  
>>>>>> dataItems,
>>>>>> clearOnClose: true});
>>>>>> }
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>
>>>>>
>>>>
>>>>
>>>
>>>
>>
>>
>
> --
> View this message in context: http://www.nabble.com/ItemFileReadStore-problem-exception-tp24726269p24746744.html
> Sent from the Dojo mailing list archive at Nabble.com.
>
> _______________________________________________
> FAQ: http://dojotoolkit.org/support/faq
> Book: http://dojotoolkit.org/docs/book
> Forums: http://dojotoolkit.org/forum
> Dojo-interest@...
> http://mail.dojotoolkit.org/mailman/listinfo/dojo-interest

_______________________________________________
FAQ: http://dojotoolkit.org/support/faq
Book: http://dojotoolkit.org/docs/book
Forums: http://dojotoolkit.org/forum
Dojo-interest@...
http://mail.dojotoolkit.org/mailman/listinfo/dojo-interest

Re: ItemFileReadStore problem/exception - POSSIBLE SOLUTION

by DHall :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

After pounding away at this occasionally for several weeks . . .

It appears that you cannot clone ItemFileReadStore individual items (per onItem); dojo.clone throws an exception.  You also cannot clone the array of ItemFileReadStore items (per onComplete) for the same reason.

I needed something generalized because I intended to this functionality with more than one datastore, holding possibly slightly different types of items. So, I could not hard code the creation of a new item object with pre-determined fields.

I came up with . . . (incomplete code, but it gets the point across)

var request = datastore.fetch({query: {'DESC': value},
                queryOptions: {ignoreCase: true},
                onComplete: getItems,
                onError: function () {log("error with subtypeCheck!");}});
subInput.store = arrayToItemReadStore(request.foundItems, "VALUE", "VALUE");
subInput.store.fetch();


var getItems = function(items, request){
        request.foundItems = new Array();
        dojo.forEach(items, function(item){
                var foundItem = new Object();
                dojo.mixin(foundItem, item);
                request.foundItems.push(foundItem);
        });
}



Dustin Machi-2 wrote:
It sounds to me like you are sharing source objects.  Since objects  
are passed by reference and the ItemFileReadStore then 'takes' over  
the object that gets passed.  You cannot then take that same object  
and pass it off to another store constructor. You would need to clone  
it first.

Dustin

On Jul 30, 2009, at 4:26 PM, lukess wrote:

>
> Hi,
>
>   I found a solution to my problem but seems to me a bug in dojo
> refrencing.....
>
> so now what i did is, from my backend i am sending three data stores  
> out of
> which two have exactly the same values. and now in the front end  
> instead of
>
>
> var store1 = new dojo.data.ItemFileReadStore({data: storeData1});
> dropdown2.store = store1;
>
> var dropdown3 = new dijit.form.FilteringSelect({id:'t3',
> autoComplete:false},domFieldObj);
> dropdown3.store = store1;
>
>
> i am creating identical store and refrencing it.
>
> var dropdown3 = new dijit.form.FilteringSelect({id:'t3',
> autoComplete:false},domFieldObj);
> var store2 = new dojo.data.ItemFileReadStore({data: storeData2});
> dropdown3.store = store2;
>
> Thanks anyways....
>
>
>
>
> lukess wrote:
>>
>> In my last i had a typo
>>
>>
>> function changetQuery(id)
>> {
>> if (id && id != '')
>> {
>> var vfpQuery = {fid:id};
>> dijit.byId("t2").setDisabled(false);
>> dijit.byId("t3").setDisabled(false);
>> dijit.byId("t2").query = vfpQuery;
>> dijit.byId("t3").query = vfpQuery;
>> }
>>
>> }
>>
>>
>>
>> lukess wrote:
>>>
>>> Hi, here is my samplecode:
>>>
>>> var sampleStore1;
>>> var sampleStore2;
>>>
>>> //somevar1 has the data which is kind of linked
>>>
>>> var dropdown1 = new dijit.form.FilteringSelect({id:'t1',
>>> autoComplete:false},domFieldObj);
>>> storeData = eval(sampleStore1);
>>>
>>> var store = new dojo.data.ItemFileReadStore({data: storeData});
>>> dropdown1.store = store;
>>>
>>> var dropdown2 = new dijit.form.FilteringSelect({id:'t2',
>>> autoComplete:false},domFieldObj);
>>> storeData1 = eval(sampleStore2);
>>>
>>> var store1 = new dojo.data.ItemFileReadStore({data: storeData1});
>>> dropdown2.store = store1;
>>>
>>> var dropdown3 = new dijit.form.FilteringSelect({id:'t3',
>>> autoComplete:false},domFieldObj);
>>> dropdown3.store = store1;
>>>
>>> {......}
>>> and then on the onclick event of dropdown1 i have function
>>>
>>> function changetQuery(id)
>>> {
>>> if (id && id != '')
>>> {
>>> var vfpQuery = {fid:id};
>>> dijit.byId("dropdown2").setDisabled(false);
>>> dijit.byId("dropdown3").setDisabled(false);
>>> dijit.byId("dropdown2").query = vfpQuery;
>>> dijit.byId("dropdown3").query = vfpQuery;
>>> }
>>>
>>> }
>>>
>>> for the first time this works fine but once i try to click on  
>>> dropdown2
>>> it throws the error, but not for the dropdown3.....
>>>
>>> don't know what's going wrong....
>>>
>>>
>>> lukess wrote:
>>>>
>>>> Hi all,
>>>>
>>>>  I joined this group because a friend of mine told me this is the  
>>>> most
>>>> active group for dojo people, i asked a problem and still haven't  
>>>> found
>>>> a solution..
>>>>
>>>> and more specifically the error says:
>>>>
>>>> dojo.data.ItemFileReadStore: Invalid item argument.
>>>>    (57 out of range 16)
>>>>
>>>>
>>>>
>>>> lukess wrote:
>>>>>
>>>>> I am also facing the same problem... Don't know if this is the  
>>>>> known
>>>>> bug or any thing else...
>>>>>
>>>>> DHall wrote:
>>>>>>
>>>>>> I have two related arrays of information, stored in memory. The  
>>>>>> first
>>>>>> list is array of event type objects, the second an array of event
>>>>>> subtype objects, with info that links to to their parent event  
>>>>>> type.
>>>>>>
>>>>>> I read them both into ItemFileReadStores.
>>>>>>
>>>>>> I link the event type ItemFileReadStore to a FilteringSelect. The
>>>>>> onchange for that filtering select needs to produce a
>>>>>> ItemFileReadStore that can be linked to a second filtering  
>>>>>> select,
>>>>>> based on a subset of the event subtype objects.
>>>>>>
>>>>>> Basically, the below accesses the value of the event type, then
>>>>>> fetches the objects that match that value from the subtype data  
>>>>>> store.
>>>>>> (eventScheduledSubTypeDataStore is a globally defined object  
>>>>>> that I
>>>>>> hope to use over and over.)
>>>>>>
>>>>>> The below works fine the FIRST time it runs. It never works  
>>>>>> again,
>>>>>> instead producing:
>>>>>> [Exception... "'Error: dojo.data.ItemFileReadStore: Invalid item
>>>>>> argument.' when calling method:  
>>>>>> [nsIDOMEventListener::handleEvent]"
>>>>>> nsresult: "0x8057001c (NS_ERROR_XPC_JS_THREW_JS_OBJECT)"  
>>>>>> location:
>>>>>> "<unknown>" data: no], throwing this error on the var  
>>>>>> request . . .
>>>>>> etc line when stepping through with firebug.
>>>>>>
>>>>>> I look at eventScheduledSubTypeDataStore in firebug and it  
>>>>>> appears
>>>>>> unchanged: all the objects have their VALUE and DESC fields  
>>>>>> correctly
>>>>>> associated.
>>>>>>
>>>>>> Does anyone have (a) any suggestion on what might be wrong or  
>>>>>> (b) a
>>>>>> suggestion on a better way to do this? Thanks.
>>>>>>
>>>>>> function  subtypeCheck (input, viewerId){
>>>>>> var form = dijit.byId("eventForm_"+ viewerId);
>>>>>> var type = form.attr('value').EVENT_TYPE;
>>>>>> var value = input.attr("value");
>>>>>> if(type.toLowerCase() == "scheduled"){
>>>>>> var subInput = dijit.byId("eventSubtypeValue_" + viewerId);
>>>>>> var request = eventScheduledSubTypeDataStore.fetch({query:  
>>>>>> {'DESC':
>>>>>> value},
>>>>>> queryOptions: {ignoreCase: true},
>>>>>> onComplete: updateValues,
>>>>>> onError: function () {log("error with subtypeCheck!");}});
>>>>>> subInput.store = arrayToDataStore(request.items, "VALUE",  
>>>>>> "VALUE");
>>>>>> subInput.store.fetch();
>>>>>> }
>>>>>>
>>>>>> }
>>>>>>
>>>>>> var updateValues = function(items, request){
>>>>>> request.items = items;
>>>>>> }
>>>>>>
>>>>>> function arrayToDataStore(array, id, lab){
>>>>>> var dataItems = {
>>>>>> identifier: id,
>>>>>> 'label': lab,
>>>>>> items: array
>>>>>> };
>>>>>> return dataStore = new dojo.data.ItemFileReadStore({data:  
>>>>>> dataItems,
>>>>>> clearOnClose: true});
>>>>>> }
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>
>>>>>
>>>>
>>>>
>>>
>>>
>>
>>
>
> --
> View this message in context: http://www.nabble.com/ItemFileReadStore-problem-exception-tp24726269p24746744.html
> Sent from the Dojo mailing list archive at Nabble.com.
>
> _______________________________________________
> FAQ: http://dojotoolkit.org/support/faq
> Book: http://dojotoolkit.org/docs/book
> Forums: http://dojotoolkit.org/forum
> Dojo-interest@mail.dojotoolkit.org
> http://mail.dojotoolkit.org/mailman/listinfo/dojo-interest

_______________________________________________
FAQ: http://dojotoolkit.org/support/faq
Book: http://dojotoolkit.org/docs/book
Forums: http://dojotoolkit.org/forum
Dojo-interest@mail.dojotoolkit.org
http://mail.dojotoolkit.org/mailman/listinfo/dojo-interest

Re: ItemFileReadStore problem/exception - POSSIBLE SOLUTION

by Dustin Machi-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I meant that you would need to clone the items before the store takes  
over those items.  Items returning from a fetch can't be treated as  
simple javascript objects with the IFRS.  Jared might be able to tell  
you a better way to do this for this particular store.

Dustin



On Aug 26, 2009, at 5:54 PM, DHall wrote:

>
> After pounding away at this occasionally for several weeks . . .
>
> It appears that you cannot clone ItemFileReadStore individual items  
> (per
> onItem); dojo.clone throws an exception.  You also cannot clone the  
> array of
> ItemFileReadStore items (per onComplete) for the same reason.
>
> I needed something generalized because I intended to this  
> functionality with
> more than one datastore, holding possibly slightly different types  
> of items.
> So, I could not hard code the creation of a new item object with
> pre-determined fields.
>
> I came up with . . . (incomplete code, but it gets the point across)
>
> var request = datastore.fetch({query: {'DESC': value},
> queryOptions: {ignoreCase: true},
> onComplete: getItems,
> onError: function () {log("error with subtypeCheck!");}});
> subInput.store = arrayToItemReadStore(request.foundItems, "VALUE",  
> "VALUE");
> subInput.store.fetch();
>
>
> var getItems = function(items, request){
> request.foundItems = new Array();
> dojo.forEach(items, function(item){
> var foundItem = new Object();
> dojo.mixin(foundItem, item);
> request.foundItems.push(foundItem);
> });
> }
>
>
>
>
> Dustin Machi-2 wrote:
>>
>> It sounds to me like you are sharing source objects.  Since objects
>> are passed by reference and the ItemFileReadStore then 'takes' over
>> the object that gets passed.  You cannot then take that same object
>> and pass it off to another store constructor. You would need to clone
>> it first.
>>
>> Dustin
>>
>> On Jul 30, 2009, at 4:26 PM, lukess wrote:
>>
>>>
>>> Hi,
>>>
>>>  I found a solution to my problem but seems to me a bug in dojo
>>> refrencing.....
>>>
>>> so now what i did is, from my backend i am sending three data stores
>>> out of
>>> which two have exactly the same values. and now in the front end
>>> instead of
>>>
>>>
>>> var store1 = new dojo.data.ItemFileReadStore({data: storeData1});
>>> dropdown2.store = store1;
>>>
>>> var dropdown3 = new dijit.form.FilteringSelect({id:'t3',
>>> autoComplete:false},domFieldObj);
>>> dropdown3.store = store1;
>>>
>>>
>>> i am creating identical store and refrencing it.
>>>
>>> var dropdown3 = new dijit.form.FilteringSelect({id:'t3',
>>> autoComplete:false},domFieldObj);
>>> var store2 = new dojo.data.ItemFileReadStore({data: storeData2});
>>> dropdown3.store = store2;
>>>
>>> Thanks anyways....
>>>
>>>
>>>
>>>
>>> lukess wrote:
>>>>
>>>> In my last i had a typo
>>>>
>>>>
>>>> function changetQuery(id)
>>>> {
>>>> if (id && id != '')
>>>> {
>>>> var vfpQuery = {fid:id};
>>>> dijit.byId("t2").setDisabled(false);
>>>> dijit.byId("t3").setDisabled(false);
>>>> dijit.byId("t2").query = vfpQuery;
>>>> dijit.byId("t3").query = vfpQuery;
>>>> }
>>>>
>>>> }
>>>>
>>>>
>>>>
>>>> lukess wrote:
>>>>>
>>>>> Hi, here is my samplecode:
>>>>>
>>>>> var sampleStore1;
>>>>> var sampleStore2;
>>>>>
>>>>> //somevar1 has the data which is kind of linked
>>>>>
>>>>> var dropdown1 = new dijit.form.FilteringSelect({id:'t1',
>>>>> autoComplete:false},domFieldObj);
>>>>> storeData = eval(sampleStore1);
>>>>>
>>>>> var store = new dojo.data.ItemFileReadStore({data: storeData});
>>>>> dropdown1.store = store;
>>>>>
>>>>> var dropdown2 = new dijit.form.FilteringSelect({id:'t2',
>>>>> autoComplete:false},domFieldObj);
>>>>> storeData1 = eval(sampleStore2);
>>>>>
>>>>> var store1 = new dojo.data.ItemFileReadStore({data: storeData1});
>>>>> dropdown2.store = store1;
>>>>>
>>>>> var dropdown3 = new dijit.form.FilteringSelect({id:'t3',
>>>>> autoComplete:false},domFieldObj);
>>>>> dropdown3.store = store1;
>>>>>
>>>>> {......}
>>>>> and then on the onclick event of dropdown1 i have function
>>>>>
>>>>> function changetQuery(id)
>>>>> {
>>>>> if (id && id != '')
>>>>> {
>>>>> var vfpQuery = {fid:id};
>>>>> dijit.byId("dropdown2").setDisabled(false);
>>>>> dijit.byId("dropdown3").setDisabled(false);
>>>>> dijit.byId("dropdown2").query = vfpQuery;
>>>>> dijit.byId("dropdown3").query = vfpQuery;
>>>>> }
>>>>>
>>>>> }
>>>>>
>>>>> for the first time this works fine but once i try to click on
>>>>> dropdown2
>>>>> it throws the error, but not for the dropdown3.....
>>>>>
>>>>> don't know what's going wrong....
>>>>>
>>>>>
>>>>> lukess wrote:
>>>>>>
>>>>>> Hi all,
>>>>>>
>>>>>> I joined this group because a friend of mine told me this is the
>>>>>> most
>>>>>> active group for dojo people, i asked a problem and still haven't
>>>>>> found
>>>>>> a solution..
>>>>>>
>>>>>> and more specifically the error says:
>>>>>>
>>>>>> dojo.data.ItemFileReadStore: Invalid item argument.
>>>>>>   (57 out of range 16)
>>>>>>
>>>>>>
>>>>>>
>>>>>> lukess wrote:
>>>>>>>
>>>>>>> I am also facing the same problem... Don't know if this is the
>>>>>>> known
>>>>>>> bug or any thing else...
>>>>>>>
>>>>>>> DHall wrote:
>>>>>>>>
>>>>>>>> I have two related arrays of information, stored in memory. The
>>>>>>>> first
>>>>>>>> list is array of event type objects, the second an array of  
>>>>>>>> event
>>>>>>>> subtype objects, with info that links to to their parent event
>>>>>>>> type.
>>>>>>>>
>>>>>>>> I read them both into ItemFileReadStores.
>>>>>>>>
>>>>>>>> I link the event type ItemFileReadStore to a FilteringSelect.  
>>>>>>>> The
>>>>>>>> onchange for that filtering select needs to produce a
>>>>>>>> ItemFileReadStore that can be linked to a second filtering
>>>>>>>> select,
>>>>>>>> based on a subset of the event subtype objects.
>>>>>>>>
>>>>>>>> Basically, the below accesses the value of the event type, then
>>>>>>>> fetches the objects that match that value from the subtype data
>>>>>>>> store.
>>>>>>>> (eventScheduledSubTypeDataStore is a globally defined object
>>>>>>>> that I
>>>>>>>> hope to use over and over.)
>>>>>>>>
>>>>>>>> The below works fine the FIRST time it runs. It never works
>>>>>>>> again,
>>>>>>>> instead producing:
>>>>>>>> [Exception... "'Error: dojo.data.ItemFileReadStore: Invalid  
>>>>>>>> item
>>>>>>>> argument.' when calling method:
>>>>>>>> [nsIDOMEventListener::handleEvent]"
>>>>>>>> nsresult: "0x8057001c (NS_ERROR_XPC_JS_THREW_JS_OBJECT)"
>>>>>>>> location:
>>>>>>>> "<unknown>" data: no], throwing this error on the var
>>>>>>>> request . . .
>>>>>>>> etc line when stepping through with firebug.
>>>>>>>>
>>>>>>>> I look at eventScheduledSubTypeDataStore in firebug and it
>>>>>>>> appears
>>>>>>>> unchanged: all the objects have their VALUE and DESC fields
>>>>>>>> correctly
>>>>>>>> associated.
>>>>>>>>
>>>>>>>> Does anyone have (a) any suggestion on what might be wrong or
>>>>>>>> (b) a
>>>>>>>> suggestion on a better way to do this? Thanks.
>>>>>>>>
>>>>>>>> function  subtypeCheck (input, viewerId){
>>>>>>>> var form = dijit.byId("eventForm_"+ viewerId);
>>>>>>>> var type = form.attr('value').EVENT_TYPE;
>>>>>>>> var value = input.attr("value");
>>>>>>>> if(type.toLowerCase() == "scheduled"){
>>>>>>>> var subInput = dijit.byId("eventSubtypeValue_" + viewerId);
>>>>>>>> var request = eventScheduledSubTypeDataStore.fetch({query:
>>>>>>>> {'DESC':
>>>>>>>> value},
>>>>>>>> queryOptions: {ignoreCase: true},
>>>>>>>> onComplete: updateValues,
>>>>>>>> onError: function () {log("error with subtypeCheck!");}});
>>>>>>>> subInput.store = arrayToDataStore(request.items, "VALUE",
>>>>>>>> "VALUE");
>>>>>>>> subInput.store.fetch();
>>>>>>>> }
>>>>>>>>
>>>>>>>> }
>>>>>>>>
>>>>>>>> var updateValues = function(items, request){
>>>>>>>> request.items = items;
>>>>>>>> }
>>>>>>>>
>>>>>>>> function arrayToDataStore(array, id, lab){
>>>>>>>> var dataItems = {
>>>>>>>> identifier: id,
>>>>>>>> 'label': lab,
>>>>>>>> items: array
>>>>>>>> };
>>>>>>>> return dataStore = new dojo.data.ItemFileReadStore({data:
>>>>>>>> dataItems,
>>>>>>>> clearOnClose: true});
>>>>>>>> }
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>
>>>>>>
>>>>>
>>>>>
>>>>
>>>>
>>>
>>> --
>>> View this message in context:
>>> http://www.nabble.com/ItemFileReadStore-problem-exception-tp24726269p24746744.html
>>> Sent from the Dojo mailing list archive at Nabble.com.
>>>
>>> _______________________________________________
>>> FAQ: http://dojotoolkit.org/support/faq
>>> Book: http://dojotoolkit.org/docs/book
>>> Forums: http://dojotoolkit.org/forum
>>> Dojo-interest@...
>>> http://mail.dojotoolkit.org/mailman/listinfo/dojo-interest
>>
>> _______________________________________________
>> FAQ: http://dojotoolkit.org/support/faq
>> Book: http://dojotoolkit.org/docs/book
>> Forums: http://dojotoolkit.org/forum
>> Dojo-interest@...
>> http://mail.dojotoolkit.org/mailman/listinfo/dojo-interest
>>
>>
>
> --
> View this message in context: http://www.nabble.com/ItemFileReadStore-problem-exception-tp24726269p25160603.html
> Sent from the Dojo mailing list archive at Nabble.com.
>
> _______________________________________________
> FAQ: http://dojotoolkit.org/support/faq
> Book: http://docs.dojocampus.org
> Dojo-interest@...
> http://mail.dojotoolkit.org/mailman/listinfo/dojo-interest

_______________________________________________
FAQ: http://dojotoolkit.org/support/faq
Book: http://docs.dojocampus.org
Dojo-interest@...
http://mail.dojotoolkit.org/mailman/listinfo/dojo-interest