You use #Column.autofocus to place the keyboard focus in a chosen input column when that column appears in an editable table, so users can start entering data in a new row without selecting the field first.
What #Column.autofocus does
#Column.autofocus is a column setting for an editable table. When MDriven renders a row and the configured column is available for input, focus moves to that column's input control.
Use it when users repeatedly add rows and should begin typing in the same field each time.
For example, an order-entry table may contain Item number, Description, and Quantity columns. If users create a new row by entering an item number first, set #Column.autofocus on the Item number column. After the new row appears, the item-number field receives focus.
Configure autofocus for a table column
- Open the ViewModel that contains the editable table in MDriven Designer.
- Select the column that represents the field where users should start typing.
- Add the #Column.autofocus setting to that column.
- Run the view and create a new table row.
- Confirm that the input control in the configured column receives focus when the new row appears.
Configure autofocus on the column that is the first meaningful input for the row. In a table used to enter a list of numbers, this is typically the number field rather than a description or calculated-value column.
Example: entering a list of numbers
Assume an editable table has a Value column and an action that adds a row.
- The user chooses the action to add a row.
- MDriven displays the new row.
- Because the Value column has #Column.autofocus, focus moves to the Value input in that new row.
- The user can type the next number immediately.
This avoids requiring the user to click the new row before entering each value.
Choose the right autofocus mechanism
| Need | Use | Example |
|---|---|---|
| Focus a field in a specific editable table column | #Column.autofocus | Focus the Item number field after a user adds an order line. |
| Automatically select an input field when it appears in a view | the autofocus tagged value
|
Focus a search field when a view opens. |
Related column settings
Use #Column.autofocus for focus behavior, not for the input type or browser autocomplete behavior.
- Column.Texttype controls the HTML input type.
- Column.autocomplete enables autocomplete for a field.
