#### Datatables - Autofill

Statistics Invoices Schedule

##### Basic initialization

AutoFill gives an Excel like option to a DataTable to click and drag over multiple cells, filling in information over the selected cells and incrementing numbers as needed. AutoFill is initialised using the `autoFill` option as shown in the example below. This can be set to be `true` to use the AutoFill configuration defaults, or used as an `object` to specify options.

First Name | Last Name | Job Title | DOB | Status | Actions
--- | --- | --- | --- | --- | ---
Marth | Enright | Traffic Court Referee | 22 Jun 1972 | Active |
Jackelyn | Weible | Airline Transport Pilot | 3 Oct 1981 | Inactive |
Aura | Hard | Business Services Sales Representative | 19 Apr 1969 | Suspended |
Nathalie | Pretty | Drywall Stripper | 13 Dec 1977 | Pending |
Sharan | Leland | Aviation Tactical Readiness Officer | 30 Dec 1991 | Inactive |
Maxine | Woldt | Business Services Sales Representative | 17 Oct 1987 | Pending |
Sylvia | Mcgaughy | Hemodialysis Technician | 11 Nov 1983 | Suspended |
Lizzee | Goodlow | Technical Services Librarian | 1 Nov 1961 | Suspended |
Kennedy | Haley | Senior Marketing Designer | 18 Dec 1960 | Active |
Chantal | Nailor | Technical Services Librarian | 10 Jan 1980 | Inactive |
Delma | Bonds | Lead Brand Manager | 21 Dec 1968 | Pending |
Roland | Salmos | Senior Program Developer | 5 Jun 1986 | Inactive |
Coy | Wollard | Customer Service Operator | 12 Oct 1982 | Active |
Maxwell | Maben | Regional Representative | 25 Feb 1988 | Suspended |
Cicely | Sigler | Senior Research Officer | 15 Mar 1960 | Pending |

##### Always confirm action

The `autoFill.alwaysAsk` option can be used to force AutoFill to confirm the action to take, even if there is only one option. This provides the end user with the ability to cancel the action if they made a mistake during the drag. This example shows `autoFill.alwaysAsk` set to `true` - to demonstrate, try auto filling a single row or column.

First Name | Last Name | Job Title | DOB | Status | Actions
--- | --- | --- | --- | --- | ---
Marth | Enright | Traffic Court Referee | 22 Jun 1972 | Active |
Jackelyn | Weible | Airline Transport Pilot | 3 Oct 1981 | Inactive |
Aura | Hard | Business Services Sales Representative | 19 Apr 1969 | Suspended |
Nathalie | Pretty | Drywall Stripper | 13 Dec 1977 | Pending |
Sharan | Leland | Aviation Tactical Readiness Officer | 30 Dec 1991 | Inactive |
Maxine | Woldt | Business Services Sales Representative | 17 Oct 1987 | Pending |
Sylvia | Mcgaughy | Hemodialysis Technician | 11 Nov 1983 | Suspended |
Lizzee | Goodlow | Technical Services Librarian | 1 Nov 1961 | Suspended |
Kennedy | Haley | Senior Marketing Designer | 18 Dec 1960 | Active |
Chantal | Nailor | Technical Services Librarian | 10 Jan 1980 | Inactive |
Delma | Bonds | Lead Brand Manager | 21 Dec 1968 | Pending |
Roland | Salmos | Senior Program Developer | 5 Jun 1986 | Inactive |
Coy | Wollard | Customer Service Operator | 12 Oct 1982 | Active |
Maxwell | Maben | Regional Representative | 25 Feb 1988 | Suspended |
Cicely | Sigler | Senior Research Officer | 15 Mar 1960 | Pending |

##### Click focus

The click-to-drag auto fill handle can be attached to the table using a number of different triggers. This is set by the `autoFill.focus` option: `click`, `focus` and `hover`. The default behaviour is `hover`, unless KeyTable is also initialised on the same table, in which case focus is used. This example shows the `click` behaviour. Click a cell to show the auto fill handle. Note that a click outside of the table will cause the handle to be removed.

First Name | Last Name | Job Title | DOB | Status | Actions
--- | --- | --- | --- | --- | ---
Marth | Enright | Traffic Court Referee | 22 Jun 1972 | Active |
Jackelyn | Weible | Airline Transport Pilot | 3 Oct 1981 | Inactive |
Aura | Hard | Business Services Sales Representative | 19 Apr 1969 | Suspended |
Nathalie | Pretty | Drywall Stripper | 13 Dec 1977 | Pending |
Sharan | Leland | Aviation Tactical Readiness Officer | 30 Dec 1991 | Inactive |
Maxine | Woldt | Business Services Sales Representative | 17 Oct 1987 | Pending |
Sylvia | Mcgaughy | Hemodialysis Technician | 11 Nov 1983 | Suspended |
Lizzee | Goodlow | Technical Services Librarian | 1 Nov 1961 | Suspended |
Kennedy | Haley | Senior Marketing Designer | 18 Dec 1960 | Active |
Chantal | Nailor | Technical Services Librarian | 10 Jan 1980 | Inactive |
Delma | Bonds | Lead Brand Manager | 21 Dec 1968 | Pending |
Roland | Salmos | Senior Program Developer | 5 Jun 1986 | Inactive |
Coy | Wollard | Customer Service Operator | 12 Oct 1982 | Active |
Maxwell | Maben | Regional Representative | 25 Feb 1988 | Suspended |
Cicely | Sigler | Senior Research Officer | 15 Mar 1960 | Pending |

##### Column selector

This ability to exclude columns from the AutoFill action can be particularly useful if the table contains non-data columns. This example uses the Select extension for DataTables to allow row selection through the select option, with row selection restricted to the first column. Thus we do not wish to have AutoFill on that column and the selector `:not(:first-child)` for `autoFill.columns` enacts that.

| First Name | Last Name | Job Title | DOB | Status | Actions
--- | --- | --- | --- | --- | --- | ---
| Marth | Enright | Traffic Court Referee | 22 Jun 1972 | Active |
| Jackelyn | Weible | Airline Transport Pilot | 3 Oct 1981 | Inactive |
| Aura | Hard | Business Services Sales Representative | 19 Apr 1969 | Suspended |
| Nathalie | Pretty | Drywall Stripper | 13 Dec 1977 | Pending |
| Sharan | Leland | Aviation Tactical Readiness Officer | 30 Dec 1991 | Inactive |
| Maxine | Woldt | Business Services Sales Representative | 17 Oct 1987 | Pending |
| Sylvia | Mcgaughy | Hemodialysis Technician | 11 Nov 1983 | Suspended |
| Lizzee | Goodlow | Technical Services Librarian | 1 Nov 1961 | Suspended |
| Kennedy | Haley | Senior Marketing Designer | 18 Dec 1960 | Active |
| Chantal | Nailor | Technical Services Librarian | 10 Jan 1980 | Inactive |
| Delma | Bonds | Lead Brand Manager | 21 Dec 1968 | Pending |
| Roland | Salmos | Senior Program Developer | 5 Jun 1986 | Inactive |
| Coy | Wollard | Customer Service Operator | 12 Oct 1982 | Active |
| Maxwell | Maben | Regional Representative | 25 Feb 1988 | Suspended |
| Cicely | Sigler | Senior Research Officer | 15 Mar 1960 | Pending |