show()

Since: Editor 1.0

Show one or more fields in the display that was previously hidden.
Please note - this property requires the Editor extension for DataTables.

Description

This method provides the ability to show a field in the end user's displayed form at any time (assuming the field was previously hidden using hide()). This can be useful for cases when you want to have extra form fields available, but only show them under certain conditions (for example when a particular value is selected, you might provide further options based on that value).

This is the inverse of the hide() method.

Note that the field().show() method introduced in Editor 1.3 provides the same functionality as this method for individual fields. Both forms will continue to be supported in future versions of Editor, and they can often be used interchangeably for single fields. The key difference is in the return value - this method will return a DataTable.Editor instance, while the field().show() method returns a DataTable.Editor.Field instance. This can effect how you chain methods if you are using the returned value for chaining.

Type

show( [ fieldName [, animate ] ] )

Show one or more fields in the form display.

Parameters:

Returns:

DataTable.Editor: Editor instance

Examples

Show all fields in a form instance:

editor.show();

Use show() and hide() to control which fields are visible:

editor
	.hide(['account_manager', 'access_style'])
	.show(['account_type', 'access_level'])
	.title('Create new user')
	.buttons('Save')
	.create('Add new user');

Show and hide a field, based on user input:

$('input', editor.field('dept').node()).on('change', function () {
	if (editor.field('dept').val() === 'Marketing') {
		editor.show('marketing-section');
	}
	else {
		editor.hide('marketing-section');
	}
});