[CLOSED] Custom buttons Ext.Msg.show do not appear 4.8.3

  1. #1

    [CLOSED] Custom buttons Ext.Msg.show do not appear 4.8.3

    Hi,
    see my example, if I set custom buttons into Ext.Msg.show, the buttons do not appear, in 4.8.3 ext.net version.
    Please help me.

    Jimmy

    <%@ Page Language="C#" %>
    
    
    <!DOCTYPE html>
    
    
    <html>
    <head runat="server">
        <title></title>
    
    
        <script type="text/javascript">
    
    
    
    
            var btnClick = function () {
    
    
                Ext.Msg.show({
                    title: 'Title',
                    msg: 'Message message message message message message message message',
                    buttons: [
                        { text: 'yes', itemId: 'yes' },
                        { text: 'no', itemId: 'no' },
                        { text: 'cancel', itemId: 'cancel' },
                        { text: 'custom', itemId: 'custom' },
                    ],
                    fn: function (btn) {
    
    
                        alert(btn);
    
    
                    }
    
    
                });
    
    
            }
    
    
        </script>
    
    
    </head>
    <body>
        <ext:ResourceManager runat="server" />
        
        <ext:Button ID="btn" runat="server" Text="Show Message Box">
    
    
            <Listeners>
                <Click Handler="btnClick();" />
            </Listeners>
    
    
        </ext:Button>
    
    
    </body>
    </html>
  2. #2
    Hello Jimmy!

    The documentation on the Ext.window.MessageBox component is really unclear on how to write custom buttons, and it looks as if it suggests using buttons the way you did should work, while it doesn't.

    Furthermore the equivalent to itemId you can use is a fixed set: yes no cancel ok
    Anything other than that is just ignored -- so you can have up to 4 buttons in the dialog without doing deep changes into the component (in this case you should just go with a window and a bottom/status bar with centered buttons; program their behavior on click).

    A step ahead, itemId is not recognized in the buttons scope. What is supported there is a object with what you see as itemId in documentation as the object's key. Not an array either. In other words, this should work:

    buttons: {yes: 'Yes', no: 'No', cancel: 'Cancel', ok: 'Custom' },
    I believe for your needs you can just use one of the buttons (the ok one for instance) as your custom one. Again, if you need to go even further ahead, you'd better switching to a custom implementation of the dialog window (via, for example, an actual ext:Window component).

    Hope this helps!
    Fabrício Murta
    Developer & Support Expert
  3. #3
    Hello Fabricio,
    thank you for your reply, fortunately I only need one more button, it is not very nice that to respect the ordering of the buttons I have to change the meaning of the keys:
    my example --> buttons: { ok: 'yes', yes: 'no', no: 'No All', cancel: 'Cancel', } to obtain "yes, no, no all, cancel".
    Is it possible to specify the order of the buttons?
    Thank you

    Jimmy
  4. #4
    Is it possible to specify the order of the buttons?
    As mentioned by Fabricio above, configuring an <ext:Window> is your best bet for that scenario.
    Geoffrey McGill
    Founder & CEO
  5. #5
    Hi Geoffrey,
    ok, I will make a dedicated window.
    Thank you

    Jimmy

Similar Threads

  1. [CLOSED] Ext.Msg.show maxWidth config
    By softmachine2011 in forum 2.x Premium Help
    Replies: 5
    Last Post: Sep 21, 2012, 11:56 AM
  2. Replies: 11
    Last Post: Aug 08, 2012, 3:02 PM
  3. [CLOSED] Ext.Msg.Show Configuration
    By dtamils in forum 1.x Help
    Replies: 2
    Last Post: Dec 01, 2011, 1:57 PM
  4. [CLOSED] Set Focus to OK button in Ext.Msg.Show
    By speedstepmem3 in forum 1.x Premium Help
    Replies: 1
    Last Post: Jun 13, 2011, 2:12 PM
  5. [CLOSED] [1.0] Ext.Msg.Show Code behind
    By state in forum 1.x Premium Help
    Replies: 5
    Last Post: Jan 15, 2010, 4:27 PM

Posting Permissions