PDA

View Full Version : [CLOSED] StoreId not used in store definition as of build 363



BillHodges
9 Apr 2012, 6:56 AM
When I add a new JsonStore, the definition of the store remains as the default name rather than the storeId. For example:



Ext.define('MyApp.store.MyJsonStore7', {
extend: 'Ext.data.Store',
requires: [
'MyApp.model.LockMD'
],

constructor: function(cfg) {
var me = this;
cfg = cfg || {};
me.callParent([Ext.apply({
storeId: 'LockST',
model: 'MyApp.model.LockMD',
..................


Before 363, the definition and the storeId matched:



Ext.define('MyApp.store.TableIndexST', {
extend: 'Ext.data.Store',
requires: [
'MyApp.model.TableIndexMD'
],

constructor: function(cfg) {
var me = this;
cfg = cfg || {};
me.callParent([Ext.apply({
storeId: 'TableIndexST',
model: 'MyApp.model.TableIndexMD',
................................


Is this a bug or new desired behavior?
Thanks

jjohnston
9 Apr 2012, 10:12 AM
I'm not sure I'm following -- are you saying that in previous builds when you modified the storeId then the userClassName would automatically be changed to the same value? As far as I am aware that was never the case.

The only recent change I'm aware of regarding storeId vs. userClassName is that in ExtJS projects we now make all data-bound view components reference their store by its userClassName, whereas they used to reference the storeId. This change was necessary due to a bug in ExtJS where it incorrectly ignores the storeId for stores registered by a MVC Application/Controller, registering them by their class name instead. The code we generate now takes this bug into account.

We may be changing the 'store' config UI for view components to display both the class name and storeId instead of just the class name, to avoid potential confusion.

BillHodges
9 Apr 2012, 10:47 AM
That behavior is certainly what I saw prior to the latest build. Now any new JSON store gets the automatically generated definition. I see the same auto-name in Inspector and have to use it when I add the store to a component. Below is a snippet from the entry point of an app I'm working on. The last two stores were added after the #366 upgrade



Ext.Loader.setConfig({
enabled: true
});

Ext.application({
models: [
'ConnectInfoMD',
'ConnectionsMD',
'CmdMD',
'UserMD',
'AllTablesMD',
'TableMD',
'TableIndexMD',
'MyModel7',
'MyModel8',
'LockMD',
'BlockingLockMD'
],
stores: [
'ConnectST',
'ResultST',
'DBConnST',
'CmdST',
'UserST',
'AllTablesST',
'TableST',
'TableIndexST',
'IndexTreeST',
'MyJsonStore7',
'MyJsonStore6'
],
views: [
'MyViewport'
],
autoCreateViewport: true,
name: 'MyApp'
});

jjohnston
9 Apr 2012, 10:58 AM
I tried this in a build from February and I don't see what you describe -- changing the storeId leaves the userClassName untouched. I have to manually change the userClassName to the same value in order for components to be able to reference it.



Ext.define('MyApp.store.MyArrayStore', {
extend: 'Ext.data.Store',

constructor: function(cfg) {
var me = this;
cfg = cfg || {};
me.callParent([Ext.apply({
storeId: 'foo',
proxy: {
type: 'ajax',
reader: {
type: 'array'
}
}
}, cfg)]);
}
});


Anyway, the result of that other change I mentioned is that for Ext projects the storeId config is irrelevant, unless you're going to use it from manual JS code -- only the userClassName is used for registering and referencing stores.

BillHodges
9 Apr 2012, 11:35 AM
You're right in that I do see the userClassName with that value. I obviously have been setting it the past and completely forgot about it. Sorry about the wild goose chase!