pub struct DataSection {
pub label: String,
pub fields: Vec<DataField>,
pub error: Option<String>,
pub render: Option<Rc<dyn Fn(Vec<DataField>) -> DomElement>>,
pub fieldset_style: FieldsetStyle,
pub fieldset_css: Option<Css>,
pub new_group: bool,
}Expand description
A section of form with label and a field (or field set).
Fields§
§label: String§fields: Vec<DataField>§error: Option<String>§render: Option<Rc<dyn Fn(Vec<DataField>) -> DomElement>>§fieldset_style: FieldsetStyle§fieldset_css: Option<Css>§new_group: boolImplementations§
Source§impl DataSection
impl DataSection
Sourcepub fn with_string_field(
label: impl Into<String>,
key: impl Into<String>,
original_value: impl Into<String>,
) -> Self
pub fn with_string_field( label: impl Into<String>, key: impl Into<String>, original_value: impl Into<String>, ) -> Self
Create a new form section with single string field.
Sourcepub fn with_opt_string_field(
label: impl Into<String>,
key: impl Into<String>,
original_value: &Option<String>,
) -> Self
pub fn with_opt_string_field( label: impl Into<String>, key: impl Into<String>, original_value: &Option<String>, ) -> Self
Create a new form section with single optional string field.
pub fn add_field(self, key: impl Into<String>, value: DataFieldValue) -> Self
Sourcepub fn add_string_field(
self,
key: impl Into<String>,
original_value: impl Into<String>,
) -> Self
pub fn add_string_field( self, key: impl Into<String>, original_value: impl Into<String>, ) -> Self
Add another string field to form section (text input).
Sourcepub fn add_opt_string_field(
self,
key: impl Into<String>,
original_value: &Option<String>,
) -> Self
pub fn add_opt_string_field( self, key: impl Into<String>, original_value: &Option<String>, ) -> Self
Add another optional string field to form section (text input).
Sourcepub fn add_list_field(
self,
key: impl Into<String>,
original_value: Option<impl Into<String>>,
options: Vec<String>,
) -> Self
pub fn add_list_field( self, key: impl Into<String>, original_value: Option<impl Into<String>>, options: Vec<String>, ) -> Self
Add another list field to form section (dropdown with options).
Sourcepub fn add_static_dict_field(
self,
key: impl Into<String>,
original_value: Option<i64>,
options: Vec<(i64, String)>,
) -> Self
pub fn add_static_dict_field( self, key: impl Into<String>, original_value: Option<i64>, options: Vec<(i64, String)>, ) -> Self
Add another dict field to form section based on static (non-reactive) dictionary Renders dropdown with options, value are stored as integer.
Sourcepub fn add_dict_field(
self,
key: impl Into<String>,
original_value: Option<i64>,
options: Computed<Vec<(i64, String)>>,
) -> Self
pub fn add_dict_field( self, key: impl Into<String>, original_value: Option<i64>, options: Computed<Vec<(i64, String)>>, ) -> Self
Add another dict field to form section based on reactive dictionary Renders dropdown with options, value are stored as integer.
Sourcepub fn add_multiselect_field(
self,
key: impl Into<String>,
original_value: Vec<i64>,
options: Computed<HashMap<i64, String>>,
add_label: impl Into<String>,
) -> Self
pub fn add_multiselect_field( self, key: impl Into<String>, original_value: Vec<i64>, options: Computed<HashMap<i64, String>>, add_label: impl Into<String>, ) -> Self
Add multiselect field to form section (multiple search inputs, value stored as integer).
Sourcepub fn add_bool_field(
self,
key: impl Into<String>,
original_value: Option<impl Into<bool>>,
) -> Self
pub fn add_bool_field( self, key: impl Into<String>, original_value: Option<impl Into<bool>>, ) -> Self
Add another bool field to form section (checkbox input).
Sourcepub fn add_image_field(
self,
key: impl Into<String>,
original_value: Option<impl Into<String>>,
) -> Self
pub fn add_image_field( self, key: impl Into<String>, original_value: Option<impl Into<String>>, ) -> Self
Add another image field to form section.
Sourcepub fn set_fieldset_style(self, fieldset_style: FieldsetStyle) -> Self
pub fn set_fieldset_style(self, fieldset_style: FieldsetStyle) -> Self
Set FieldsetStyle for this section.
Sourcepub fn set_fieldset_css(self, fieldset_css: Css) -> Self
pub fn set_fieldset_css(self, fieldset_css: Css) -> Self
Set Css for fields container for this section.
Sourcepub fn starts_new_group(self) -> Self
pub fn starts_new_group(self) -> Self
This section starts a new section group (Form adds a horizontal rule)
Trait Implementations§
Source§impl Default for DataSection
impl Default for DataSection
Source§fn default() -> DataSection
fn default() -> DataSection
Auto Trait Implementations§
impl Freeze for DataSection
impl !RefUnwindSafe for DataSection
impl !Send for DataSection
impl !Sync for DataSection
impl Unpin for DataSection
impl !UnwindSafe for DataSection
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more