Hello dear community. Recently facing a store binding problem for a week and posted this issue to Stackoverflow but couldn't find any useful help yet. I'll kindly ask you some opinion on issue which you will see below.
Thanks a lot.
When I'm binding a `ViewModel` based `store` in a `panel` gives this error below. I've tried to give alias and id to store but could not be success.
Code:
Uncaught Error: [Ext.create] Invalid class name or alias 'undefined' specified, must be a non-empty string
This is where I bind to store;
Code:
getDashBoard: function(){
var me = this;
me.infoCards = [
{
xtype: 'infocard',
bind: '{infoStore}'
}
];
return me.infoCards;
},
I had defined the store separately and I've refactored it, defined whole store configs under ViewModel. Now I can get data with `ajax` request but the error keep raising as well;
Code:
Ext.define('MyApp.view.ListVM', {
extend: 'Ext.app.ViewModel',
alias: 'viewmodel.list',
requires: [
...
],
stores: {
infoStore: {
model: 'MyApp.model.base.ResultModel',
autoLoad: true,
session: true,
storeId: 'infoStore',
proxy: {
url: MyApp.Globals.getUrl() + '/list/stat/gen',
type: 'ajax',
reader: {
type: 'json',
rootProperty: 'data'
}
}
}
}
});
Here is the model & `infocard` if needed to see;
Code:
Ext.define('MyApp.model.base.ResultModel', {
extend: 'Ext.data.Model',
fields: [
{name: 'code', type: MyApp.FldTypes.STRING},
{name: 'totalcount', type: MyApp.FldTypes.NUMBER}
]
});
Ext.define('MyApp.ux.infocard.InfoCard', {
extend: 'Ext.panel.Panel',
xtype: 'infocard',
userCls: 'infocardCls',
border: true,
width: 150,
height: 100,
bodyStyle: '@include box-shadow(0 1px 2px 0 rgba(0,0,0,0.2));display:inline-block;box-shadow: 10px 5px 5px #BDBDBD;background-color:#EEEEEE;',
items: [
// Button will replace to updating the data
// {
// xtype: 'button',
// handler: 'onInfoPanelClick'
// },
{
xtype: 'container',
layout: {type: 'hbox', align: 'end', pack: 'center'},
items: [
{
xtype: 'container',
layout: {type: 'vbox', align: 'middle', pack: 'end'},
flex: 2,
items: [
{
xtype: 'container',
userCls: 'infocardCount',
bind: {
html: '{totalcount}'
},
flex: 1
},
{xtype: 'component', height: 10},
{
xtype: 'container',
userCls: 'infocardCode',
bind: {
html: '{code}'
},
flex: 1
}
]
},
{
xtype: 'container',
bind: {
// html: '<span class="x-fa fa-{glyph} infocardGlyph">'
glyph: MyApp.Globals.getGlyph('{glyph}')
},
flex: 1
}
]
}
]
});
and somehow this is the side-effect of `bind: {infostore}` on Navigation menu. When it's being collapsed then seems like this @ https://prnt.sc/ij1lor and when `bind` config is commented then behaviours normal. Well the app is developing with Sencha's admindashboard template.