Was this helpful?
0 votes
|
What is the best way in Angular to put focus on a textbox following an event, i.e. a button click? Here is my scenario: Our app has a page with a table displaying customer data. The first column in each row has an 'Edit' button. When clicked the data in all other columns turn into editable textboxes. Next I need to put focus on the first textbox, which is the name of the customer. Any assistance is appreciated. |
Was this helpful?
0 votes
|
The HTML view can be either in two modes. Initially, it is in 'display' mode and the customer records are displayed in an HTML table in non-edit (read-only) mode. In each row, there is a Edit button which when clicked toggles the row to 'edit' mode and the input text boxes are displayed for each cell. Instead of the Edit button, the Save and Cancel buttons are then displayed. The Cancel button discards the changes made by the user in 'edit' mode while the Save button accepts those changes and in both the cases, the user is taken back to the 'display' mode. Notice the presence of two scripts in the HTML view with the ids named 'edit' and 'display' and they are executed depending upon when the user clicks the Edit or Save/Cancel buttons respectively.
|
Was this helpful?
0 votes
|
You can read the source code of this third-party module. You'll learn a lot from it. http://vitalets.github.io/angular-xeditable/ https://github.com/vitalets/angular-xeditable There is also its jsfiddle ... |
asked | Apr 03, 2016 |
viewed | 1948 times |
active | Apr 06, 2016 |