PDA

View Full Version : UUID Generator



jpcook01
24 Aug 2011, 12:49 AM
Hi,

I am trying to get the uuid generation working, I have the following model:



Ext.define('NavBuilder.NavigationNode', {
extend: 'Ext.data.Model',
idgen: 'uuid',
proxy: {
type: 'memory'
},
fields: [
{ name: 'id', type: 'string'},
{ name: 'text', type: 'string'},
{ name: 'url', type: 'string'},
{ name: 'containerType', type: 'string'},
{ name: 'isFrontPage', type: 'boolean'},
{ name: 'isCrumb', type: 'boolean'},
{ name: 'activateWhenSiblingsActive', type: 'boolean'},
{ name: 'activateWhenParentActive', type: 'boolean'},
{ name: 'activateWhenAncestorActive', type: 'boolean'},
{ name: 'alwaysActive', type: 'boolean'},
{ name: 'hideChildren', type: 'boolean'},
]
});


Creating an instance of this object:


var node = Ext.create('NavBuilder.NavigationNode', {
text : 'hello'
});
console.log(node);


I would expect to see a uuid for the id of this object but I just get an id of ext-record-5. Is there something else I need to do in order for the unique id generation to work?

Thanks
Jonathan

skirtle
24 Aug 2011, 2:57 AM
I just tried your code and it seemed to work fine for me. The internalId was of the form you suggest but the id itself looks like a UUID.

What ExtJS version are you using? I tested 4.0.2 and 4.0.5.

To confirm, could you try this?


console.log(node.getId());