1. #1
    Sencha User
    Join Date
    Mar 2012
    Posts
    56
    Vote Rating
    0
    aorlic is on a distinguished road

      0  

    Default Default butons on dialog

    Default butons on dialog


    Hi!

    How can I set typical default buttons on a dialog to reuse their expected behavior:

    - OK button (reacts on ENTER pressed while any field on the form is in focus)
    - Cancel button (does the same as ESC key)

    Another related question... Which event is raised when ESC is pressed, just before closing the dialog? This would be a place to put "Are you sure?" msg box..

    Thanks!

  2. #2
    Sencha - Support Team scottmartin's Avatar
    Join Date
    Jul 2010
    Location
    Houston, Tx
    Posts
    8,927
    Vote Rating
    443
    scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future

      0  

    Default


    Where you looking for something like this?

    Code:
    Ext.Msg.prompt('Name', 'Please enter your name:', function(btn, text){
        if (btn == 'ok'){
            // prompt and/or process text value and close...
        }
    });​
    Regards,
    Scott

  3. #3
    Sencha User
    Join Date
    Mar 2012
    Posts
    56
    Vote Rating
    0
    aorlic is on a distinguished road

      0  

    Default


    @scottmartin,

    no, that's not what I want.

    I have a custom-made dialog (actually a lot of them, every app does) and among other buttons, it has a default OK-button (which sometimes is "Save" or "Procede", "Confirm" or just "Ok") and a default CANCEL-button (to cancel the operation and close the dialog upon confirmation msg-box).

    OK-button can also be "pressed" by pressing enter anytime, while the dialog is in focus.
    CANCEL-button can be "pressed" by pressing ESC (in Ext JS this works in case of a little "x" button on the dialog's caption bar)

    I hope this clarifies my problem.

    Thank you all in advance!

  4. #4
    Sencha - Support Team scottmartin's Avatar
    Join Date
    Jul 2010
    Location
    Houston, Tx
    Posts
    8,927
    Vote Rating
    443
    scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future

      0  

    Default


    Perhaps you are referring to something like this?

    Code:
    var formSearch = new Ext.FormPanel({
    	items: [
    		{
    			xtype: 'textfield',
    			handler: searchSubmit
    		}
    	],
    	keys: [ {key : [10,13],fn:searchSubmit} ], // submit on enter
    	buttons: [
    		{ text: 'Search', handler: searchSubmit },
    		{ text: 'Reset', handler: function() { .. }
    		}
    	]
    });
     
    function searchSubmit() {
    // execute search
    }
    Regards,
    Scott.

  5. #5
    Sencha User
    Join Date
    Mar 2012
    Posts
    56
    Vote Rating
    0
    aorlic is on a distinguished road

      0  

    Default


    @scottmartin,

    Thank you again, we are getting closer.

    I see another problem now, related with the way I catch button events.

    I have a controller class who is responsible for button clicks and other events... For example, my loginDlg has a button "login" and the corresponding controller catches it the following way:

    Code:
    this.control({
                'login  #btn_login': {
                    click: this.onLoginClicked
                }
            });
    So, in order to implement your solution, I would have to call the controller's onLoginClicked() method from the View... Is that possible?

    Or I should change the whole logic and instead of catching the event this way, I could fire it from the view and listen to them in the controller...

    What do you think?

  6. #6
    Sencha - Support Team scottmartin's Avatar
    Join Date
    Jul 2010
    Location
    Houston, Tx
    Posts
    8,927
    Vote Rating
    443
    scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future

      0  

    Default


    You can assign action: 'loginOk' to your view button and then in your controller
    #btn_logon[action=loginOk]

    Scott.

  7. #7
    Sencha User
    Join Date
    Mar 2012
    Posts
    56
    Vote Rating
    0
    aorlic is on a distinguished road

      0  

    Default


    Hi again Scott!

    If I understand your idea well, it won't resolve my initial problem. Iw will work for the button click, but what happens with the key event?

    How can I assign the same handler function (defined in the controller, see my example code) with both events (buton click AND the key 13 press while anywhere on the form)?

Thread Participants: 1

Turkiyenin en sevilen filmlerinin yer aldigi xnxx internet sitemiz olan ve porn sex tarzi bir site olan mobil porno izle sitemiz gercekten dillere destan bir durumda herkesin sevdigi bir site olarak tarihe gececege benziyor. Sitenin en belirgin ozelliklerinden birisi de Turkiyede gercekten kaliteli ve muntazam, duzenli porno izle siteleri olmamasidir. Bu yuzden iste. Ayrica en net goruntu kalitesine sahip adresinde yayinlanmaktadir. Mesela diğer sitelerimizden bahsedecek olursak, en iyi hd porno video arşivine sahip bir siteyiz. "The Best anal porn videos and slut anus, big asses movies set..." hd porno faketaxi