PDA

View Full Version : JsonView



var1en
10 Apr 2007, 11:58 AM
not fires event "load"



var addressBody = addressPanel.getEl().createChild({tag:'div'});


// create the required templates
this.addressTemplate = new Ext.Template(
'<div id="{addr_id}" class="address-view"><address>'+
'{address}<br/>'+
'{city}, {state} {zip}<br/>'+
'{country}'+
'</address></div>'
);
this.addressTemplate.compile();

this.addressView = new Ext.JsonView(addressBody, this.addressTemplate, {
singleSelect: true,
jsonRoot: 'addresses',
emptyText : '<div style="padding:10px;">No address found</div>'
});

this.addressView.on({
load : function (view, data, response) {
alert('loadEvent');
},
loadexception : function (view, data, response) {
alert('loadExceptionEvent');
},
click : this.onClickAddressView.createDelegate(this)
});

var panel = new Ext.NestedLayoutPanel(this.addressLayout, { closable : false, background: !tabInfo.active, title: 'Addresses'});
panel.on('activate', function() {
this.addressView.load({url:this.addressViewUrl + 'id/'+ this.customerCardId +'/'});
}, this);

jack.slocum
10 Apr 2007, 12:20 PM
I don't see anything in particular wrong with your code. Does the view actually update?

dfenwick
10 Apr 2007, 2:59 PM
As a followup for those that are interested, we solved this on the IRC server. The problem was with globally assigned loadScripts. In order for this to work, on the load() function, we had to put in a config option {scripts: false} to get the update event to execute.