[CLOSED] Create GUID

  1. #1

    [CLOSED] Create GUID

    How to use EXTJS create guid ?
    Last edited by Daniil; Jan 21, 2015 at 12:58 PM. Reason: [CLOSED]
  2. #2
    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.
    Geoffrey McGill
    Founder
  3. #3
    hello my friend. I need to create the script side.
  4. #4
    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.
  5. #5
    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>
  6. #6
    now we can not create a guid in client side?
  7. #7
    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 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.
  8. #8
    I need to use the database. Ext.id not help me. need to look at the JavaScript function. Thanks to everyone.

Similar Threads

  1. [CLOSED] How to add Guid[] property to the component?
    By pil0t in forum 1.x Legacy Premium Help
    Replies: 3
    Last Post: Apr 22, 2011, 2:23 PM
  2. SQL GUID USE AT GRID PANEL
    By sadeque in forum 1.x Help
    Replies: 1
    Last Post: Feb 03, 2010, 3:32 AM
  3. Replies: 4
    Last Post: Dec 28, 2009, 12:07 PM
  4. GUID in Ext:Label.Text property...
    By shaun in forum 1.x Help
    Replies: 2
    Last Post: Jul 26, 2009, 8:14 PM
  5. [CLOSED] AjaxMethods: System.Guid as parameter not working
    By pschojer in forum 1.x Legacy Premium Help
    Replies: 6
    Last Post: Jun 23, 2009, 5:46 AM

Posting Permissions