PDA

View Full Version : [CLOSED] Create GUID



siyahgul
Jan 14, 2015, 2:09 PM
How to use EXTJS create guid ?

geoffrey.mcgill
Jan 14, 2015, 2:20 PM
Hello,

I do not know of any "create guid" functionality within ExtJS.

If you provide a link to something specific to ExtJS and we should be able to offer suggestions on how to use within Ext.NET.

siyahgul
Jan 14, 2015, 2:37 PM
hello my friend. I need to create the script side.

Daniil
Jan 14, 2015, 8:03 PM
Hi @siyahgul,

Please clarify do you need to generate some GUID in JavaScript?

If yes, you could try with

Ext.id()
http://docs.sencha.com/extjs/4.2.1/#!/api/Ext-method-id

It generates an id that is unique in the current page.

Dimitris
Jan 14, 2015, 9:27 PM
Or, if I have understood the question correctly, having server side provide (new) GUID to the client, for example:



<%@ Page Language="C#" %>

<script runat="server">
[DirectMethod]
public Guid GetGuid()
{
return Guid.NewGuid();
}
</script>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>

</head>
<body>
<form id="form1" runat="server">
<ext:ResourceManager runat="server" />
<ext:Button ID="Button1" runat="server" Text="Get GUID" Icon="Lightning">
<Listeners>
<Click Handler="
App.direct.GetGuid({
success: function (result) {
Ext.Msg.alert('Guid created: ', result);
}
});" />
</Listeners>
</ext:Button>
</form>
</body>
</html>

siyahgul
Jan 15, 2015, 4:09 PM
now we can not create a guid in client side?

fabricio.murta
Jan 15, 2015, 4:55 PM
If you want to create just a simple ID guaranteed to be unique on the page, the solution Daniil provided you with does the trick.

Every time you call Ext.id() it generates an unique ID you can use on the page elements/controls (avoiding ID conflicts). That's if what you need is unique IDs for HTML or Ext elements.

If what you want is really a fully fledged GUID client-side, all you have to do is use this simple script (http://guid.us/GUID/JavaScript) on your pages.

By the way, don't think GUID is unique, always. A friend just had an entire site overwritten by believing he will never hit a duplicated GUID. After rendering an GUID, always verify whether it already exists on your sample or not. If it exists, just keep re-generating, your chances of having duplicates are quite low.

I hope this helps.

siyahgul
Jan 16, 2015, 10:15 AM
I need to use the database. Ext.id not help me. need to look at the JavaScript function. Thanks to everyone.