I started with this example: http://www.sencha.com/blog/using-ext...ur-application
What I want is to change the "on-script" data from grid with another data from my database. For this, I did the following changes:
Code:
Ext.define('Elearning.stores.UserStore', {
extend : 'Ext.data.Store',
requires : ['Elearning.models.UserModel'],
storeId : 'usersStore',
model : 'Elearning.models.UserModel',
proxy: {
type: 'ajax',
url : '/data/getUsers.php',
reader: {
type: 'json',
root: 'users'
}
},
autoLoad: true,
constructor : function() {
this.callParent(arguments);
}
});
I also edited the file UsersGridPanel.js
Code:
Ext.define('Elearning.views.UsersGridPanel', {
extend : 'Ext.grid.Panel',
alias : 'widget.UsersGridPanel',
requires : ['Elearning.stores.UserStore'],
initComponent : function() {
this.store = Elearning.stores.UserStore;
this.columns = this.buildColumns();
this.callParent();
},
buildColumns : function() {
return [
{
header : 'First Name',
dataIndex : 'nume',
width : 70
},
{
header : 'Last Name',
dataIndex : 'prenume',
width : 70
},
{
header : 'Email',
dataIndex : 'email',
width : 70
},
{
header : 'Username',
dataIndex : 'username',
width : 70
}
];
}
});
Unfortunately, I got an error (on Chrome console) at the red line described below with the error message Cannot call method 'getProxy' of undefined
Code:
initComponent : function() {
this.store = Elearning.stores.UserStore;
this.columns = this.buildColumns();
this.callParent();
},
Thanks in advance.