NAME
RapidApp::Manual::TableSpec - RapidApp/DBIC metadata config options
DESCRIPTION
TableSpecs are RapidApp-specific metadata associated with DBIx::Class Result Classes which effect the behavior of automatically generated interfaces, interacting with the given source, throughout the RapidApp application.
TableSpecs also provide additional Row methods to Result Classes when loaded.
TableSpecs can be loaded via load_components
, however loading is handled atomatically by higher-level APIs, namely RapidDbic. See RapidApp::Manual::RapidDbic for where and how to supply TableSpec params.
SOURCE CONFIG PARAMS
title
Friendly title associated with the source in single row context (i.e. singular). This is a label common to all the rows in the source. This is very often the same as the source name (the default), such as 'Album', but could be more verbose, such as 'Music Album'.
title_multi
Friendly title associated with the source in multiple row, or set context (i.e. plural). This might be 'Albums' or 'Music Albums' for the source 'Album'. This is used when showing lists of rows from the given source.
Defaults to 'SOURCE_NAME Rows' (i.e. 'Album Rows').
iconCls
Icon associated with the source in single row context (i.e. singular). This should be a CSS class name in the same format as 'iconCls' in ExtJS. This is typically something like icon-apple
where the associated class defines a background image. Expects a 16x16 icon.
This icon is displayed in various single-row contexts, such as in tab titles (for row pages) or inline in various places.
See RapidApp::Manual::Assets for information on setup of icon assets and icon CSS classes in RapidApp.
Defaults to 'ra-icon-pg'
multiIconCls
Icon associated with the source in multiple row, or set context (i.e. plural). This should be a CSS class name in the same format as 'iconCls' in ExtJS. This is typically something like icon-apples
where the associated class defines a background image. Expects a 16x16 icon.
See RapidApp::Manual::Assets for information on setup of icon assets and icon CSS classes in RapidApp.
Defaults to 'ra-icon-pg-multi'
display_column
Column used when displaying an individual row. Used when this source is the target of a single relationship (i.e. belongs_to)
Defaults to the first primary key column, or the first column if there are no primary keys.
auto_editor_type
Default editor interface to use when selecting a row from this source (i.e. setting/changing a single relationship, or belongs_to). Current supported values are grid
, combo
and custom
.
In RapidDbic this is set to custom
with an automatic config that attaches to the default grid for the source. This is effectively the same as grid
but without configuring a separate RapidApp module.
combo
sets up a simple dropdown box, with the items listed showing the value of the display_column
for each row. combo
is a nice alternative to grid
when there is a limited number of rows to select from.
columns
HashRef of column names to TableSpec column configs. See COLUMN CONFIG PARAMS below.
COLUMN CONFIG PARAMS
These config settings apply to individual columns within the source. Most of the config options from Ext.grid.Column are supported here with some additional custom behaviors. Many of these options are automatically configured based on the column type from the schema.
header
Friendly name associated with the given column. Used in labels such as grid column headers.
Defaults to the column name.
width
Default size in pixels. Default value based on the column type and length.
sortable
Boolean. Defines whether or not the column will be sortable in contexts such as grids. Defaults to true.
no_column
Boolean. Hides the column from being shown/selected as a column in grid views. Does not effect other contexts, such as Quick Search and MultiFilters (see no_quick_search
/no_multifilter
options). Defaults to false.
no_quick_search
Boolean. Excludes the column from the Quick Search in grids. Defaults to false.
no_multifilter
Boolean. Excludes the column from the MultiFilter Search in grids (Filter button). Defaults to false.
no_summary
Boolean. Excludes the column from column summaries in grids. Defaults to false.
quick_search_exact_only
Boolean. Forces queries from the Quick Search to only use exact mode ('='
instead of LIKE %string%
sub-string match) for the given column, regardless of the client-side Quick Search mode. This is already implied for numeric columns since it would never make sense to attempt to match them against a sub-string.
allow_add
Boolean. Determines if an individual column is allowed to be used when adding new rows. This setting is not relevant when the column is not already included by the creatable_colspec
. Defaults to true.
allow_edit
Boolean. Determines if an individual column is allowed to be changed when editing a row. This setting is not relevant when the column is not already included by the updatable_colspec
, or when there is no editor
defined. Defaults to true.
allow_view
Boolean. Same as no_column
setting (but inversed), but for page context (i.e. single row) instead of grid/multi context. Defaults to false when no_column
is set, but true when allow_edit
is set. Different combinations of the 3 can be used to accomplish various scenarios. For example, these settings will hide a column from grids but show it on the row page read-only:
no_column => 1,
allow_edit => 0,
allow_view => 1
editor
HashRef config of an ExtJS Field/Component. This is automatically setup based on column type, nullability, auto_editor_type for relationship columns, etc, but can be overridden here. If this is set to a false or empty value it will disable editing for the column across the board.
renderer
String or ArrayRef of Strings containing a valid JavaScript function name(s). The function should accept the value as the only argument and return the formatted value. (For example, 'Ext.util.Format.usMoney'
. If multiple functions are supplied, the functions are chained, with the return value of the previous becoming the input to the next.
Again, this is automatically configured based on the column type info.
validator
JavaScript function name used to validate a value (form/input) for the column. See validator
in Ext.form.Field.
profiles
ArrayRef list of column profile names. Column profiles are macros/sets of column configs to apply multiple options at once. Many of these are automatically set according to the column type.
Column profiles are defined in RapidApp::TableSpec::Column::Profile.
Currently available column profiles:
relcol
nullable
notnull
number
int
bool
text
bigtext
monotext
blob
html
email
datetime
date
money
percent
noadd
noedit
zipcode
filesize
autoinc
img_blob