pub struct Form { /* private fields */ }Expand description
An independent editable form instance using a compiled structure.
Implementations§
Source§impl Form
impl Form
Sourcepub fn new(
template: FormTemplate,
data: &Value,
options: BindOptions,
) -> FormResult<Self>
pub fn new( template: FormTemplate, data: &Value, options: BindOptions, ) -> FormResult<Self>
Create an instance, prepare default data and evaluate fields.
Sourcepub fn template(&self) -> &FormTemplate
pub fn template(&self) -> &FormTemplate
Return the shared structure without instance values.
Sourcepub fn set_data(&mut self, data: &Value) -> FormResult<()>
pub fn set_data(&mut self, data: &Value) -> FormResult<()>
Replace record data, restart the history and reevaluate the form atomically.
Sourcepub fn get_value(&self, path: &str) -> FormResult<Value>
pub fn get_value(&self, path: &str) -> FormResult<Value>
Return a detached value relative to the data root.
Sourcepub fn set_value(&mut self, path: &str, value: Value) -> FormResult<()>
pub fn set_value(&mut self, path: &str, value: Value) -> FormResult<()>
Update one data path and reevaluate the form atomically.
Sourcepub fn undo(&mut self) -> FormResult<()>
pub fn undo(&mut self) -> FormResult<()>
Restore the record before the last data change; the reverted record can be redone (CURT-011).
Sourcepub fn redo(&mut self) -> FormResult<()>
pub fn redo(&mut self) -> FormResult<()>
Reapply the most recently undone data change (CURT-012).
Sourcepub fn toggle_row(&mut self, path: &str, key: &str) -> FormResult<()>
pub fn toggle_row(&mut self, path: &str, key: &str) -> FormResult<()>
Expand a collapsed row or collapse an expanded one; the record and the revision do not change.
Sourcepub fn set_all_expanded(&mut self, expanded: bool) -> FormResult<()>
pub fn set_all_expanded(&mut self, expanded: bool) -> FormResult<()>
Expand every row, or collapse every collapsible row; the record and the revision do not change.
Sourcepub fn add_row(
&mut self,
path: &str,
options: AddRowOptions,
) -> FormResult<String>
pub fn add_row( &mut self, path: &str, options: AddRowOptions, ) -> FormResult<String>
Insert a row with supplied data or field defaults.
Sourcepub fn copy_row(
&mut self,
path: &str,
key: &str,
options: AddRowOptions,
) -> FormResult<String>
pub fn copy_row( &mut self, path: &str, key: &str, options: AddRowOptions, ) -> FormResult<String>
Copy current values and generate new identities for nested repeated rows.
Sourcepub fn remove_row(&mut self, path: &str, key: &str) -> FormResult<()>
pub fn remove_row(&mut self, path: &str, key: &str) -> FormResult<()>
Remove a row while enforcing the minimum count.