Ext.js Window


Ext.js Window

<!DOCTYPE html>
<html>
   <head>
      <link href = "https://cdnjs.cloudflare.com/ajax/libs/extjs/6.0.0/classic/theme-classic/resources/theme-classic-all.css"
         rel = "stylesheet" />
      <script type = "text/javascript"
         src = "https://cdnjs.cloudflare.com/ajax/libs/extjs/6.0.0/ext-all.js"></script>

      <script type = "text/javascript">
         Ext.onReady(function() {
            win = new Ext.Window ({
               title:'Email Window',
               layout:'form',
               width:400,
               closeAction:'close',
               target : document.getElementById('buttonId'),
               plain: true,

               items: [{
                  xtype : 'textfield',
                  fieldLabel: 'To'
               },{
                  xtype : 'textfield',
                  fieldLabel: 'CC'
               },{
                  xtype : 'textfield',
                  fieldLabel: 'BCC'
               },{
                  xtype : 'textfield',
                  fieldLabel: 'Subject'
               },{
                  xtype : 'textarea',
                  fieldLabel: 'Email Message'
               }],

               buttons: [{
                  text: 'Save Draft',
                  handler: function(){Ext.Msg.alert('Save Draft', 'Your msg is saved');}
               },{
                  text: 'Send',
                  handler: function(){Ext.Msg.alert('Message Sent', 'Your msg is sent');}
               },{
                  text: 'Cancel',
                  handler: function(){
                     win.close(); Ext.Msg.alert('close', 'Email window is closed');}
               }],
               buttonAlign: 'center',
            });
            Ext.create('Ext.Button', {
               renderTo: Ext.getElementById('buttonId'),
               text: 'Click Me',

               listeners: {
                  click: function() {
                     win.show();
                  }
               }
            });
         });
      </script>
   </head>

   <body>
      <p> Click the button to see window </p>
      <div id = "buttonId"></div>
   </body>
</html>