PDA

View Full Version : error Cannot call method 'getProxy' of undefined in extjs4.1



vijayakumar84
15 May 2013, 5:28 AM
Hi
can anybody tell what is problem how to fix it Cannot call method 'getProxy' of undefined

this is my app.js


Ext.application({
controllers: ["Main"],
requires : ['Ext.container.Viewport', 'TestGrid.view.GlobalTeamTable1'],
name: 'TestGrid',
views: ['Main','GlobalTeamTable1'],
models:['TestGrid.model.TestResult'],


launch:function()
{


Ext.create('Ext.container.Viewport', {
layout : 'vbox',
overflowY : 'scroll',
items : [
{
xtype : 'globalteamtable1',
width:1000,
height :1000
}


]






});
}


});



This is My View



Ext.define('TestGrid.view.GlobalTeamTable1', {
extend: 'Ext.grid.Panel',
alias: 'widget.globalteamtable1',
id:'gridid',
store: {
model: 'TestGrid.model.TestResult',
data: [{
month: 'Jan',
target1: 100,
target2: 101,
targetDiff: 1,
targetPercent: 0.99
},{
month: 'Feb',
target1: 110,
target2: 112,
targetDiff: 2,
targetPercent: 0.99
},{
month: 'Mar',
target1: 120,
target2: 121,
targetDiff: 1,
targetPercent: 0.99
},{
month: 'Apr',
target1: 130,
target2: 133,
targetDiff: 3,
targetPercent: 0.99
}]
},
columns: [{
dataIndex: 'month',
text: 'Month',
summaryRenderer: function(){
return '<b>Totals:</b>';
}
}, {
dataIndex: 'target1',
text: 'Target1',
summaryType: 'sum'
}, {
dataIndex: 'target2',
text: 'Target2',
summaryType: 'sum'
}, {
dataIndex: 'targetDiff',
text: 'Target(2-1)',
summaryType: 'sum',


}, {
dataIndex: 'targetPercent',
text: 'Target%',
summaryType: function(records){
var totals = records.reduce(function(sums, record){
return [sums[0] + record.data.target2,
sums[1] + record.data.targetDiff];
}, [0,0]);


return (totals[0] * totals[1]) / 100;
}
}]
});



this is my model











Ext.define('TestGrid.model.TestResult', {
extend: 'Ext.data.Model',
fields: ['month', {
name: 'target1',
type: 'int'
}, {
name: 'target2',
type: 'int'
}, {
name: 'targetDiff',
type: 'int'
}, {
name: 'targetPercent',
type: 'float'
}]
});




thanks

Ex_Soft
15 May 2013, 11:02 AM
This is My View

Ext.define('TestGrid.view.GlobalTeamTable1', {
extend: 'Ext.grid.Panel',
alias: 'widget.globalteamtable1',
id:'gridid',
store: {
model: 'TestGrid.model.TestResult',
data: [{
month: 'Jan',
target1: 100,
target2: 101,
targetDiff: 1,
targetPercent: 0.99
},{
...
},{
month: 'Apr',
target1: 130,
target2: 133,
targetDiff: 3,
targetPercent: 0.99
}]
},
...
});


1. Ext.grid.Panel.store (http://docs.sencha.com/extjs/4.2.0/#!/api/Ext.grid.Panel-cfg-store)
2. Ext.data.Store.proxy (http://docs.sencha.com/extjs/4.2.0/#!/api/Ext.data.Store-cfg-proxy)
???

Alexander Bauer
15 May 2013, 1:10 PM
Ext.define('TestGrid.view.GlobalTeamTable1', { extend: 'Ext.grid.Panel',
alias: 'widget.globalteamtable1',
id:'gridid',
store: {
model: 'TestGrid.model.TestResult',
data: [{
month: 'Jan',
target1: 100,
target2: 101,
targetDiff: 1,
targetPercent: 0.99
},{
...
},{
month: 'Apr',
target1: 130,
target2: 133,
targetDiff: 3,
targetPercent: 0.99
}]
},
...
});
You should define the store as a class as you did with model and add it to your controller/app using the
stores : ['MyStore'] property.