PDA

View Full Version : Ajax Exception event "requestexception" not raised



prout_boudin
22 Jul 2010, 2:19 AM
Hello,

I'm evaluating Ext. The version I used is 3.2.1.

The event requestexception on the Ajax singleton seems not to be raised correctly when instanciating a store object. (The other events of Ajax singleton are raised correctly.)

The code I used is :


Ext.Ajax.on('requestexception' , function() {

console.log('Request Exception');
} );

I've tried a listener to my store directly :


this.store.on({

exception : function(a,b,c) {

console.log("error");

}
});

and the event is not raised. (Other events raised correclty).

What is wrong ?

Tx for your help !

Fred

Animal
22 Jul 2010, 2:22 AM
What is not being done and why? Explain.

prout_boudin
22 Jul 2010, 2:31 AM
Hi Animal,

My code is as below :



Regware.Xpo.Search.SearchPanel = Ext.extend(Ext.Panel, {

layout:'border',

iconCls:'xpo-searchtab-icon',

tabTip: 'This is the search form',

store : new Ext.data.JsonStore({


url : '/svc/svc.search.json.asp',

listeners: {

loadexception : function(a,b,c) {

console.log("error");

}

}

}),

initComponent: function() {

this.store.on("exception", Regware.Xpo.Exceptions.DataProxyExceptionHanlder);




this.searchGrid = new Ext.grid.GridPanel({

frame: true,

cmargins: '15 15 15 15',

region:'center',


store: this.store,

columns: [

{header: 'Reg Date', sortable: true, dataIndex:'created', renderer: Ext.util.Format.dateRenderer('d M H:i:s')},

{header: 'Reg Ref', sortable: true, dataIndex: 'registrationreference'},

{header: 'Type', sortable: true, dataIndex: 'attendeetype', hidden: false},

{header: 'Company Name', sortable: true, dataIndex: 'companyname'},

{header: 'First Name', sortable: true, dataIndex: 'firstname'},

{header: 'Last Name', sortable: true, dataIndex: 'lastname', renderer: Ext.util.Format.uppercase},


{header: 'Amount Due', sortable: true, dataIndex: 'amountdue', hidden: false},

{header: 'Amount Paid', sortable: true, dataIndex: 'amountpaid', hidden: false},

{header: 'Still Due', sortable: true, dataIndex: 'stilldue', hidden: true}

],

bbar: new Ext.PagingToolbar({

pageSize: 30,

store: this.store,

displayInfo: true,


emptyMsg: "No records to display"

}),

viewConfig: {

forceFit:true,

frame: true,

enableRowBody: false,

deferEmptyText: true,

emptyText:'<center>No data match your request</center>',


},

sm: new Ext.grid.RowSelectionModel({singleSelect:true}),

loadMask : {

msg : 'Searching...'

}

});


Ext.apply(this, {

items: [this.searchForm, this.searchGrid]

});


this.on({

render: {

fn: function(){

this.store.load({

params: {

start: 0,

limit: this.searchGrid.getBottomToolbar().pageSize
}

});

},

scope: this,

delay: 20

}

});


this.store.on({

exception : function(a,b,c) {

console.log("error");

}

})


Regware.Xpo.Search.SearchPanel.superclass.initComponent.apply(this, arguments);

}
})

When using this code, the loadexception, and exception events are not raised.
If I just create a store and load it, all events are raised correctly.


Ext.onReady(function() {


Ext.Ajax.on('requestexception', function() {

console.log('req');

} );

store = new Ext.data.JsonStore({


url : '/svc/svc.search.json.asp',

autoLoad: true,

listeners: {

loadexception : function(a,b,c) {

console.log("error");

}

}

});


})


I don't undertand :-)

prout_boudin
22 Jul 2010, 2:48 AM
Hi Animal,

I've found my error.
I've created a general Ajax handler error. And there was an error in the handler when dealing with the store exception !

Sorry for the confusing !

Fred