View Full Version : Uncaught TypeError: Cannot call method 'indexOf' of undefined

15 Sep 2012, 5:25 AM

I am getting an error when loading store from the controller class, i am not able to understand that why this error is coming. Please help me in this to figure out the problem.

here is my code.
Ext.define('SID.controller.DashboardController', {
extend : 'Ext.app.Controller',
views : ['DashboardTab','common.GoogleMapPanel','IncidentMapPanel'],
stores : ['DashboardMapMarker','RagStatus'],
model: ['common.MapMarker','RagStatus'],

refs : [{
ref : 'dashboardtabRef',
selector : 'dashboardtab'

init : function() {
this.control( {
'dashboardtab' : {
afterrender : this.displayRagStatus


displayRagStatus : function(panel, objs) {
url : 'getRagStatus.controller',
method: 'GET',
scope: this,
success: function(response, callOptions) {
Ext.getStore('RagStatus').load( {
data: Ext.decode(response.responseText),
reader : {
type : 'json',
root : 'data',
totalProperty: 'total',
successProperty : 'success'
callback: function(records, operation, success) {


ragStatusDataLoad: function(data) {
Ext.Msg.alert("In ragStatusDataLoad");
var ragStatusTpl = new Ext.XTemplate(
'<table align="top"><tr>',
'<tpl for=".">',
'<td ><b>{financialImpact}</b></td></tr>',

I am getting the error when i am loading the store eg: Ext.getStore('RagStatus').load( {

My Store name is RagStatus, model is RagStatus.

15 Sep 2012, 6:02 AM
If you enter the URL directly in the browser, do you get the correct response from server?
Is records[1] correct in your callback? What is the result of console.log(records);


15 Sep 2012, 7:49 AM
Hi Scott,
Thanks for quick reply, Since the error is occurred at the line where i am loading the Store(Ext.getStore('RagStatus').load({ , Nothing is printing on console, its only showing that error occurred at this line. Nothing printing coming at console.

Although i have tried to call the ajax request from the store class and loaded the Store in a other class(Panel), its working fine. But when i am loading this store in Success function this error is coming.

15 Sep 2012, 8:20 AM
The response from the server is coming correct.But console.log(records) is not printing anything, error showing at Ext.getStore('RagStatus').load({.

26 Sep 2012, 12:43 PM
What do you see when you call

var store = Ext.getStore('RagStatus');

What is your response from the server when you call load?