JPKramer707
18 Sep 2012, 10:00 AM
Howdy y'all,
My grid doesn't want to show what's in my store.
The store is loading, I can inspect it in the browser and I find a store full of model instances which contain my data. The grid appears, it's just empty.
Anybody see the problem here?
Thanks in advance,
-Kramer
app.js
Ext.Loader.setConfig({
enabled: true
});
console.log('app.js');
Ext.application({
requires: ['Ext.container.Viewport'],
name: 'EPLM',
appFolder: 'app',
models: [
'ProductModel'
],
stores: [
'ProductStore'
],
views: [
],
controllers: [
'Main'
],
initComponent: function() {
this.log('initComponent');
},
launch: function() {
this.log('launch');
var grid = Ext.create('Ext.grid.Panel', {
autoRender: true,
title: 'EPLM Product List',
store: Ext.data.StoreManager.lookup('productStore'),
columns: [
{text: 'Product Name', dataIndex: 'PN'},
{text: 'RPN', dataIndex: 'RPN'},
{text: 'GPN', dataIndex: 'GPN'}
],
height: 200,
width: 400,
renderTo: Ext.getBody()
});
}
});
ProductStore
Ext.define('EPLM.store.ProductStore', {
extend: 'Ext.data.Store',
storeId: 'productStore',
requires: [
'EPLM.model.ProductModel'
],
model: 'EPLM.model.ProductModel',
constructor: function(cfg) {
this.log('Constructing');
this.log(this);
var me = this;
cfg = cfg || {};
me.callParent([Ext.apply({
autoLoad: true,
autoSync: true,
storeId: 'productStore',
model: 'EPLM.model.ProductModel',
proxy: {
type: 'ajax',
url: 'data/Products.json',
reader: {
type: 'json'
}
}
}, cfg)]);
}
});
ProductModel
Ext.define('EPLM.model.ProductModel', {
extend: 'Ext.data.Model',
belongsTo: 'ProductLine',
fields: [
{name: 'GPN', type: 'integer'},
{name: 'RPN', type: 'string'},
{name: 'PN', type: 'string'}
],
constructor: function() {
this.callParent(arguments);
//this.log('Constructed');
//this.log(this.data);
}
});
Products.json
[
{
"RPN" : "K-FPIP-1600-10BS-5",
"GPN" : 82700246021,
"PN" : "Flexipet Denuding Pipette"
},
{
"RPN" : "K-FPIP-1600-10BS-5",
"GPN" : 82700246016,
"PN" : "Flexipet Denuding Pipette"
}
]
My grid doesn't want to show what's in my store.
The store is loading, I can inspect it in the browser and I find a store full of model instances which contain my data. The grid appears, it's just empty.
Anybody see the problem here?
Thanks in advance,
-Kramer
app.js
Ext.Loader.setConfig({
enabled: true
});
console.log('app.js');
Ext.application({
requires: ['Ext.container.Viewport'],
name: 'EPLM',
appFolder: 'app',
models: [
'ProductModel'
],
stores: [
'ProductStore'
],
views: [
],
controllers: [
'Main'
],
initComponent: function() {
this.log('initComponent');
},
launch: function() {
this.log('launch');
var grid = Ext.create('Ext.grid.Panel', {
autoRender: true,
title: 'EPLM Product List',
store: Ext.data.StoreManager.lookup('productStore'),
columns: [
{text: 'Product Name', dataIndex: 'PN'},
{text: 'RPN', dataIndex: 'RPN'},
{text: 'GPN', dataIndex: 'GPN'}
],
height: 200,
width: 400,
renderTo: Ext.getBody()
});
}
});
ProductStore
Ext.define('EPLM.store.ProductStore', {
extend: 'Ext.data.Store',
storeId: 'productStore',
requires: [
'EPLM.model.ProductModel'
],
model: 'EPLM.model.ProductModel',
constructor: function(cfg) {
this.log('Constructing');
this.log(this);
var me = this;
cfg = cfg || {};
me.callParent([Ext.apply({
autoLoad: true,
autoSync: true,
storeId: 'productStore',
model: 'EPLM.model.ProductModel',
proxy: {
type: 'ajax',
url: 'data/Products.json',
reader: {
type: 'json'
}
}
}, cfg)]);
}
});
ProductModel
Ext.define('EPLM.model.ProductModel', {
extend: 'Ext.data.Model',
belongsTo: 'ProductLine',
fields: [
{name: 'GPN', type: 'integer'},
{name: 'RPN', type: 'string'},
{name: 'PN', type: 'string'}
],
constructor: function() {
this.callParent(arguments);
//this.log('Constructed');
//this.log(this.data);
}
});
Products.json
[
{
"RPN" : "K-FPIP-1600-10BS-5",
"GPN" : 82700246021,
"PN" : "Flexipet Denuding Pipette"
},
{
"RPN" : "K-FPIP-1600-10BS-5",
"GPN" : 82700246016,
"PN" : "Flexipet Denuding Pipette"
}
]