PDA

View Full Version : [CLOSED] [PR 1] Ext.data.proxy.LocalStorage -> id



tobiu
15 Oct 2011, 10:20 AM
hi team,

in ST 1.x you can specify ids containing dots, like:



id : 'SC.LocalSettings'


In ST 2 this throws the error:


Uncaught Error: [ERROR][Ext.data.proxy.LocalStorage#getObservableId] Invalid unique id of 'SC.LocalSettings' for this object


The problem is, that this error gives no clue why the id is not valid. In general it would be nice if ids can contain dots again.

mitchellsimoens
15 Oct 2011, 7:14 PM
I remember n ST1 that IDs had to be int... Could be wrong but I remember seeing that

tobiu
15 Oct 2011, 11:38 PM
hi mitchell,

maybe i did not make my point clear: i am not refering to the id inside of a model or the storeId, but to the id of the proxy. When using local storage this is important.

see the following example which is valid in ST 1.x:



Ext.regModel('SC.model.Settings', {
fields : [
{name : 'email', type : 'string'},
{name : 'id', type : 'int'},
{name : 'password', type : 'string'},
{name : 'theme', type : 'string'}
],

proxy: {
type : 'localstorage',
id : 'SC.LocalSettings'
}

});

mitchellsimoens
17 Oct 2011, 7:42 AM
Confirmed and reported :)

Just a note, regModel has been deprecated, the way to do it now is:


Ext.define('ModelName', {
extend : 'Ext.data.Model',
fields : [....]
});

tobiu
17 Oct 2011, 8:04 AM
"see the following example which is valid in ST 1.x:" :)

thx for putting it into jira!

edspencer
3 Nov 2011, 11:34 AM
This comes about because of some optimizations we've been making to Observable in relation to ComponentQuery. Although we never explicitly supported/did not support dots in a localstorage proxy id, I think this limitation is a price worth paying for the performance optimization so we'll probably explicitly not support ids with dots in going forward.

I suggest you change those to use a dash instead (especially given that it's just a string and the dot has no special significance anyway)