[CLOSED] ext:Button: Adding listener to a click event

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1

    [CLOSED] ext:Button: Adding listener to a click event

    Hi!

    I'm creating my ext:window as javascript: It is working.
    But, I wish pass the buttons of window as parameter of the function;
    I'm creating a function below to create a button. But my problem is: I want set the javascript that be executed when the button is clicked.

    In vb.Net, i do this:
    function createButton(text as string, fn as string)
         dim btn = New Ext.Net.Button
         btn.Id = "btnOk"
         btn.Text = text
        btn.Listeners.Click.Handler = fn
        return btn
    end function
    How I do it in Javascript?

    
            function createButton(text, fn) {
                var btn;
    
                btn = Ext.create("Ext.button.Button", {
                    id: "btn" + text,
                    text: text
                });
                btn.on("click", "function () {" + fn + "}");
                return btn;
            }
    Last edited by geoffrey.mcgill; Apr 13, 2012 at 12:09 AM. Reason: [CLOSED]

Similar Threads

  1. Replies: 2
    Last Post: Apr 09, 2012, 2:13 PM
  2. [CLOSED] Adding a listener to BeforeDestroy event on TabPanel
    By supera in forum 2.x Legacy Premium Help
    Replies: 2
    Last Post: Mar 22, 2012, 12:49 PM
  3. Click Listener to Button from Code-Behind
    By Alexx in forum 1.x Help
    Replies: 7
    Last Post: Jul 26, 2011, 11:26 AM
  4. Replies: 10
    Last Post: Aug 18, 2010, 2:22 AM
  5. [CLOSED] Button Click Listener bug
    By methode in forum 1.x Legacy Premium Help
    Replies: 0
    Last Post: Apr 26, 2010, 11:40 AM

Posting Permissions