Skip to content
This repository has been archived by the owner on Jan 29, 2020. It is now read-only.

metadata in details

LeonZhou edited this page Dec 9, 2015 · 2 revisions

Clojure-web-admin (CWA) provides features based on metadata. CWA can make most use of build-in metadata in database (e.g.,column-name,type-name ,nullable,etc.) and use extra metadata (key-value pairs separated by ‘\n’) in comments(e.g.,searchable,search-op,exportable,etc.).

The following types of metadeta are supported out of the box:

Bulit-in

nullable

The defaule value of nullable is 1. If a column is set to not null. The value of nullable would be 0. When the value is 0,it would add a validate rule to avoid null input.

See more details in Validation

column-name

The value of column-name would determine the value of label in a form or search-box.

column-def

The value of column-name would give a default value to an input element when create an entity.

type-name

The value of column-name would determine how to render the column in a form or search-box.

See more details in form-in-details .

decimal-digits

The defaule value is 0 and has no effects.

When set the column-name to ‘decimal’ and give it precision (e.g. decimal(5.2) ), decimal-digits is the number after the dot.

It would give a formatter rule in form input element.

[:input.form-control
  {:field :numeric :fmt "%.2f"}]

Extra

searchable

When searchable is set to 1, the column would be a search condition in search-box.

search-op

Search operation. Make most use of korma`s search operations,but recently only support some of them.

Available search operation [=, like, and, or, >, <, >=, <=, in, not-in, not, not=, between]

exportable

When exportable is set to 1,the column would be export in the excel.

lookup-table

When column-name is ‘select’,this metadate should be specified,the value represents the logic associative table.

lookup-label

When column-name is ‘select’,this metadate should be specified, the value represents the column in logic associative table which would display in dropdown selections in form.

reserved

The column can not be insert/update by users.

hidden-in-grid

Not shown in data grid.

hidden-in-form

Not shown in New/Edit form.

truncatable

Short the original value in DB.

chart-label

Specify the x-axis of bar chart

chart-value

Specified the y-axis of bar chart