ExtJS: focal field

I have a window containing a form (formPanel). Users can display this window by clicking a button in ExtJS. I would like the user to click the button to display the window, the special field inside the form contained in the window will focus (I mean, the cursor must go to this field so that the user can insert data without having to first click on the field) .

I tried some solutions, but could not get them to work. Any clues?

Here is what I tried using some examples that I found ... but it does not work as expected. This function () is called by the ExtJS button in my interface:

function openCardForm(IDUser){

    //Reset the value of this field which may be still there from the prev. usage
    Ext.getCmp('assignFormCARDNUMBER').reset();
    formAssignCard.getForm().load({ 
        url: 'gen/jsonUser.php',
        params:{IDUser:IDUser},
        waitMsg: 'Loading...'
    });
    //Try to focus the Card field when rendering the form
    Ext.getCmp('assignFormCARDNUMBER').on("render",function(){
        Ext.getCmp('assignFormCARDNUMBER').focus(true,10);
    });
    win.show();
}
+3
source share
3 answers

show .

+4

defaultButton : yourComponentToFocusOn

, defaultButton ( )

+3

You can also try setting the tabindex fields to zero in its configuration settings ... this way you won’t even need to add a listener to detect the show event.

t

tabIndex:0
+1
source

Source: https://habr.com/ru/post/1765902/


All Articles