PDA

View Full Version : JsonView not firing load event



alanwilliamson
21 Feb 2007, 3:48 PM
Good day good people, i am having a little problem here.

Consider the following snippet:



assetList = new YAHOO.ext.JsonView('assetList', imgTemplate, { multiSelect: true, jsonRoot: 'photodata' });

assetList.on( 'load', function( _v, _d, _r ){
alert( 9 );
} );

assetList.load( "/someurl" );


I can't get the alert() box to fire; the JsonView works okay as the data is rendered with no problems. Just no load event. I can get all the other events no problems.

I need to get access to the root JSON data returned, as I have other data in there I need to pull out (the total results for example).

Advice please!

tryanDLS
21 Feb 2007, 5:52 PM
Try setting BPs in JsonView.onLoad and onLoadException. There may be an error occurring at the end of the load process that's preventing it from firing the load event.

alanwilliamson
22 Feb 2007, 4:18 AM
Thanks tryanDLS, but that didn't help. No exceptions.

I have also now moved up to 1.0alpha and can confirm i am getting no "load" exception there either.

The data does come in render properly; like i said, i get all the other events just not the one i really need!

BernardChhun
23 Feb 2007, 7:23 PM
With my 0.33 and 0.40 small coding experience, it seems the loading happens in the dataModel object of the JsonView!
something like this should give you a result:


yourJsonView.dataModel.addListener('load', function(){
console.log('dataModel loading damn it!');
});