View Full Version : Creating Guid
Ex_Soft
17 Jan 2012, 5:46 AM
Is there any function to create Guid in ExtJS?
kskrumpet
17 Jan 2012, 6:46 AM
You could look at http://www.sencha.com/learn/legacy/Extension:GUID, or there are plenty of places online that give code snippets of GUID generating javascript.
strickjb
18 Jan 2012, 6:37 AM
Creating random strings can be done in plain javascript in just one line:
Math.random().toString(36).substr(2);
Example Outputs:
"ryueeqzpp7a"
"sujmtd734td"
"thw7zuowntd"
If you need something a little longer, run it a couple times more and combine the strings.
It may not be 100% "globally unique" but it's pretty close.
campersau1
18 Jan 2012, 9:49 AM
http://docs.sencha.com/ext-js/4-0/#!/api/Ext-method-id
Ex_Soft
19 Jan 2012, 12:47 AM
I need guid such as
function NewGuid() {
return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g,
function(c) {
var r = Math.random()*16|0, v = c == 'x' ? r : (r&0x3|0x8);
return v.toString(16); })
}
Powered by vBulletin® Version 4.1.5 Copyright © 2013 vBulletin Solutions, Inc. All rights reserved.