View Full Version : Help with JsonStore and 401 [Unauthorized] Response

20 Apr 2011, 7:04 AM
My server code returns a 401 when it can't authenticate the request, which is what I want. I'm using the JsonStore for the client-side. Everything loads fine when I have an 'authorized users'. But it doesn't seem that JsonStore (proxy, reader, not sure) properly handles a 401.

I error out on line #11563 of the sencha-touch-debug-w-comments.js version 1.1.0 with:
:("TypeError: Result of expression 'records' [undefined] is not an object."

This is they loadRecords stub resulting from the Ext.data.Connection.onComplete event. I'm doing a "POST" read operation, options.callback is called, and then eventually loadRecords of ."requestexception" and "exception" are still fired, but they never bubble up because of the error when trying to read through a undefined records object. Well at least I can't get the code to work that catches the event. Here is my store code:

var store = new Ext.data.JsonStore({
model: 'PatientSummary',
//sorters: 'FullName',
getGroupString: function (record) {
return record.get('FullName')[0];
proxy: {
type: 'ajax',
//id: 'id',
noCache: true,
method: 'POST',
url: patientsUrl,
reader: {
type: 'json',
root: 'PatientSummaries'
actionMethods: {
read: 'POST'

listeners: {
exception: function (proxy, type, action, o, response, args) {
s = '';