mirror of
https://github.com/nowcommunity/nowdatabase.git
synced 2026-10-12 19:13:52 +03:00
Merge pull request #368 from nowcommunity/documentation-for-dropdown-and-time-unit
Added docs for dropdownselector and time units
This commit is contained in:
@@ -0,0 +1,14 @@
|
||||
### DropDownSelector Component
|
||||
|
||||
The DropDownSelector component is used by giving it
|
||||
|
||||
- an array of `options` (Required)
|
||||
- a `name` (Required)
|
||||
- a `field` which is the field in editData that the component should change (Required)
|
||||
- a `disabled` boolean value (Optional)
|
||||
|
||||
The options array consists of strings, numbers or objects of type DropDownOption. A DropDownOption is a simple object that contains the actual value, a display string which is used to show the option's name to the user, and an optional optionDisplay string which is an alternate name for the option used, for example, when the option is inside of a menu.
|
||||
|
||||
If `disabled` is set to true, the dropdown selector cannot be clicked.
|
||||
|
||||
If the selected value is invalid, the DropDownSelector will show a red text underneath it explaining the issue. This is done by getting the validator from the current context (if one exists), and then passing it the current `editData` (also from context) and the `field` value. The validator will check if the value in editData corresponding to `field` is valid.
|
||||
@@ -16,6 +16,7 @@
|
||||
- The **DataValue** renders, depending on the mode (reading or editing), the value or a component that allows the user to edit the value.
|
||||
- The **ArrayFrame** allows you to write an entire "frame" (a grouping of data within a tab: for example in a Locality > Age tab > Age) as a two-dimensional array, which can contain for example labels or datavalues. See example in AgeTab. This is the best way to write most tabs.
|
||||
|
||||
**Detailed explanation of editingComponents**
|
||||
**Detailed documentation for editingComponents**
|
||||
|
||||
[RadioSelector](./editingComponents/radioselector.md)
|
||||
[RadioSelector](./editingComponents/RadioSelector.md)
|
||||
[DropDownSelector](./editingComponents/DropDownSelector.md)
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
### Time Unit
|
||||
|
||||
When a user creates a new time unit, the following fields are needed:
|
||||
|
||||
- Name
|
||||
- Sequence
|
||||
- Lower Bound Id
|
||||
- Upper Bound Id
|
||||
|
||||
The components that are used to change the upper or lower time bounds are `TimeBoundSelection` components. These are almost exactly the same as `FieldWithTableSelection` components, but when their value is changed, they also update the `up_bound` and `low_bound` objects in `editData`. This way when the upper/lower bound id's are changed by the user, the actual bounds are immediately updated too and can be shown to the user or passed to a validator. `TimeBoundSelection` components should not be used anywhere else.
|
||||
|
||||
Changing a time unit's name causes a foreign key error in the database because the "now_time_unit" and "now_tau" tables are connected by it. When editing a time unit, the name field is currently disabled because of this.
|
||||
Reference in New Issue
Block a user