I created a normal window in ExtJS5 which has one grid and one button. I want to get store field items from grid store and want to do another functionality.
When i get store.fields, it shows null. But if i get in ExtJS3, then it works proper.
In below image, I am getting store fields or fields items in ExtJS3.
Here is my code (ExtJS5)
Ext.onReady(function () {
var States = Ext.create('Ext.data.Store',
{
fields: ['value'],
data:
[
{ "value": "HR" },
{ "value": "DL" },
{ "value": "RJ" }
]
});
var window = new Ext.Window({
id: 'grdWindow',
width: 400,
title: 'Grid Samples',
items: [
{
xtype: 'panel',
layout: 'fit',
renderTo: Ext.getBody(),
items: [
{
xtype: 'button',
text: 'Submit',
handler: function () {
var storeFields = Ext.getCmp('grdSample').getStore().fields;
//storeFields get null;
}
},
{
xtype: 'grid',
id: 'grdSample',
store: States,
columns: [
{
header: 'Name',
dataIndex: 'value'
}
]
}
]
}]
}).show();
});
grid.getStore().getModel().getFields() should do what you want.