Column Database Operations
The database table subfields/columns that hold data for the custom columns in a Variations field are dynamically created/updated when the field is edited. The following operations are possible. Below, HTML table refers to the table markup with inputs that is used to edit this field's settings (in the Details Tab) in contrast to the datables table for this field.
To add custom columns to the Variations field, click on the link add column in the custom columns settings HTML table. This will add a row in the HTML table corresponding to a single custom column in a Variations field. On save, this action will create a column in the field's database table for each defined custom column.
You can rename your columns at any time (i.e. their names and/or their labels). If renaming the column name, this will also rename the corresponding custom columns in the field's table in the database. Please note that renaming a column will mean changing all instances of the column name in your template files if applicable. This is because the field's (PHP Class) properties are named after their respective columns.
Selecting Data Type and Data Type Options
These two settings are not optional.
To change the Data Type of a custom column, use its corresponding select dropdown in the similarly-named HTML table column.
To change the Data Type Options, use the radio buttons in the HTML table column marked Options.
If you carry out these actions, a confirmation dialog will pop-up asking you to confirm if you wish to proceed with the respective actions. Proceed with caution! This is because changing data type or their options could lead to loss of the data that was saved in those custom columns for pages using the field since it modifies the database schema for the field. If you wish to cancel, click on the Cancel button in the pop-up dialog. If, however, you are sure that you want to carry out these operations, click instead on the Save button in the pop-up. The pop-up will close and your changes will be saved.
To mark a custom column and hence a database table column of the field for deletion, click on the trash can for its row in the custom columns settings HTML table. If you wish to delete all columns, click on the trash can in the header row instead. Please note that clicking a second time on a trash can deselects previous selections. The marked HTML table rows (i.e. database columns) will be highlighted in red. If you then click on the Save button, a confirmation dialog will pop-up asking you to confirm whether you wish to proceed with the deletion. Proceed with caution! This is because deleting custom columns will lead to loss of the data that was saved in those custom columns for pages using the field since it modifies the database schema for the field. If you wish to cancel, click on the Cancel button in the pop-up dialog. All marked HTML table rows will be deselected and the pop-up will close. If, however, you are sure that you want to delete the columns, click instead on the Save button in the pop-up. The pop-up will close and the marked database table columns will be deleted. Please note the database table itself (i.e. the field) is not deleted.
Please note that all of the above operations can be carried out simultaneously.