PDA

View Full Version : Capturing success/failure response on record set (REST proxy)



justinm1
16 Sep 2013, 12:21 PM
Hi,

I'm using a checkcolumn in a grid that is calling record.set(dataIndex, checked), then firing the checkchange event. When record.set is called, it's sending a PUT request to the server, which I'm handling fine and returning a response like:


{"success":false,"message":"com.sybase.jdbc3.jdbc.SybSQLException: This is a test"}

I'm not sure though how to process that response and display a message to the user. Do I put a listener on the proxy? On the reader? None of them seem to work. Here is my store code:


Ext.define('app.store.Reports', { extend : 'Ext.data.Store',
model : 'app.model.Report',
requires: 'app.model.Report',
autoLoad: {start: 0, limit: 25},
autoSync: true,
remoteSort: true,

pageSize: 25,
proxy: {
type: 'rest',
format: 'json',
url: '/corpcov_config/cxf/rest/ReportService/report',
reader: {
type: 'json',
totalProperty: 'totalCount',
root: 'reports',
successProperty: 'success',
messageProperty: 'message'
},
writer: {
type: 'json',
root: 'reports',
allowSingle: false
},
},
sorters : [{
property : 'reportNumber',
direction: 'ASC'
}],

});




Any ideas what I'm missing?

ettavolt
17 Sep 2013, 8:43 AM
Try write (http://docs.sencha.com/extjs/4.2.1/#!/api/Ext.data.AbstractStore-event-write) event on a store.