View Full Version : Store exception

27 May 2013, 4:56 PM
I am new to ExtJS - created a Store and Model as below-- and the error is

Uncaught TypeError: Property 'prgsum' of object [object Window] is not a function

Source Class: http://localhost:8080/?method=prgsum&_dc=1369702453208&page=1&start=0&limit=100&callback=Ext.data.JsonP.callback44 Line 1

Ext.define('MyApp.model.PrgSum', {
extend: 'Ext.data.Model',

idProperty: 'plant',

fields: [
name: 'plant'
name: 'tz'
name: 'ordcnt'

proxy: {
type: 'jsonp',
url: 'http://localhost:8080/?method=prgsum',
reader: {
type: 'json',
root: 'data',
successProperty: 'SUCCESS',
totalProperty: 'RESULTS'

// Store

Ext.define('MyApp.store.PrgSumStore', {
extend: 'Ext.data.Store',

requires: [

constructor: function(cfg) {
var me = this;
cfg = cfg || {};
autoLoad: true,
model: 'MyApp.model.PrgSum',
storeId: 'idPrgSumStore',
pageSize: 100
}, cfg)]);

url: http://localhost:8080/?method=prgsum
prgsum({"data":[ { "plant": "Topeka", "tz": "CST", "ordcnt": "10000" }, { "plant": "Perry", "tz": "EST", "ordcnt": "10000" }, { "plant": "Denver", "tz": "MST", "ordcnt": "10000" }, { "plant": "Rosenberg", "tz": "CST", "ordcnt": "10000" } ],"SUCCESS":true,"RESULTS":4});

27 May 2013, 5:15 PM
Look at the url:


It's expecting the callback method to be


27 May 2013, 5:19 PM
Is there something I need to include in the Store configuration.

27 May 2013, 11:47 PM
when using jsonp

you need to wrap the returned data in a function (in this case Ext.data.JsonP.callback44)

so your data will look like in this case

the mime type of the returned data needs to be text/javascript (not application/json)

so the callback string that is given to the request needs to be used to create the function name that wraps your data coming back from the server. (hint: this is dynamic, so next time it will be callback=Ext.data.jsonP.callback45), so you can't hard code it