Results 1 to 2 of 2

Thread: Verify if a box has already been created dynamically via a function

  1. #1
    Sencha User
    Join Date
    Jan 2016
    Posts
    11
    Answers
    1

    Default Answered: Verify if a box has already been created dynamically via a function

    Hi,

    I have a button in a panel that is used to create a ComboBox. When the user clicks on the button, I want to verify if the combobox has already been created or not so that it will not be duplicated in my panel.

    My code:

    Code:
    {
    			xtype: "button",
    			text: "Get keys...",
    			width: '20',
    			handler: function(){
    				var keysForm = new Ext.create('Ext.form.ComboBox', {
    					fieldLabel: 'Choose key to render',
    					//store: 
    					queryMode: 'local',
    					//displayField:
    				});
    				getLayerAndKeys.add(keysForm);
    			}
    		}
    How can I achieve that ?

    Thanks

  2. There's a bunch of different ways you could do it, one would be to use a single handler:

    Code:
    {
        xtype: 'button',
        listeners: {
            single: true,
            click: function() {
                // I only get run once
            }
        }
    }

  3. #2
    Sencha Premium User
    Join Date
    Apr 2007
    Location
    Sydney, Australia
    Posts
    19,258
    Answers
    759

    Default

    There's a bunch of different ways you could do it, one would be to use a single handler:

    Code:
    {
        xtype: 'button',
        listeners: {
            single: true,
            click: function() {
                // I only get run once
            }
        }
    }

Similar Threads

  1. Replies: 1
    Last Post: 26 Jul 2012, 4:24 AM
  2. Cannot Specify id For Dynamically Created Button
    By Mike6679 in forum Sencha Touch 2.x: Q&A
    Replies: 1
    Last Post: 13 Jul 2012, 12:57 PM
  3. How to add a Grid to a dynamically created DIV
    By Packmule in forum Ext 3.x: Help & Discussion
    Replies: 2
    Last Post: 7 Mar 2012, 12:36 AM
  4. Replies: 4
    Last Post: 24 Dec 2011, 8:34 PM
  5. Replies: 2
    Last Post: 27 Nov 2010, 3:59 PM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •