You must set messageProperty to the proxy reader in 'Ext.data.Store' .
reader: { type: 'json', root: 'myDataList', totalProperty: 'myTotalRecord', successProperty: 'mySuccess', messageProperty : 'myMsg' }
when mySuccess returns false , then callback: function called.
store.load({ params: {start: 0, limit: 15}, callback: function (records, operation, success) { if (!success) { try { Ext.Msg.alert('Sorry !', operation.getError());
Here is the json answer from Java Servlet.
Map<String, Object> myDataMap = new HashMap<>(3); try { // Something myDataMap.put("mySuccess", true); myDataMap.put("myMsg", "Whats up khomeni !"); } catch (Exception e) { myDataMap.put("mySuccess", false); myDataMap.put("myMsg", "Whats wrong with me."); } String json = new Gson().toJson(myDataMap);
Mr. Mak
source share