[Dojo-interest] ItemFileReadStore problem/exception

DHall d.hall at delcan.com
Wed Jul 29 15:47:05 EDT 2009


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-tp24726269p24726269.html
Sent from the Dojo mailing list archive at Nabble.com.



More information about the Dojo-interest mailing list