https://github.com/codedcontainer/blazorselectlistcomponents
Blazor list components for handlling internal or JSON data
https://github.com/codedcontainer/blazorselectlistcomponents
Last synced: 11 months ago
JSON representation
Blazor list components for handlling internal or JSON data
- Host: GitHub
- URL: https://github.com/codedcontainer/blazorselectlistcomponents
- Owner: codedcontainer
- Created: 2023-10-16T19:37:09.000Z (over 2 years ago)
- Default Branch: master
- Last Pushed: 2023-10-16T19:47:31.000Z (over 2 years ago)
- Last Synced: 2025-01-05T07:50:40.495Z (about 1 year ago)
- Language: HTML
- Size: 8.79 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: Readme.md
Awesome Lists containing this project
README
# Blazor Select List Components
## Select List Component
### Description
A Blazor select list component styled using Bootstrap 5. This component uses reflection and a generic list of objects to create a `` element and nested `` elements.
### How To Run ###
* Make sure to have .net 7 framework runtime installed on your machine
* Make sure to have dotnet cli installed
* Run `dotnet run` from inside of the BlazorSelectList directory
### Example
```
```
### Attributes
| Attribute | Desc | Required?|
|-----------|------|----------|
| Data | List of generic objects. Example: `var People = List`. | Y |
| ValueKey | Object property key that assigns each option's value attribute. Example: `...` | Y
| TextKey | Object property key that assigns each option's text value. Example: `{TextKey.Value}>...`. | Y
| DefaultText | Prepends a new option element and assigns the options text value. | N
| DefaultValue | Sets the prepended option element's value. | N
| SelectedOptionByValue | Sets an option element to 'selected' by a matching option value attribute. | N
## Select List JSON Component
### Description
This component works similarly to the select list component but handles a serialized JSON string instead of a list of generic C# objects.Deserialization the JSON string uses C# JSON DOM and `JsonNode`.
### Example
```
```
### Attributes
| Attribute | Desc | Required?|
|-----------|------|----------|
| Data | Serialized JSON array. **Must be a single-dimensional array of objects.** Example: `"[{Id:1, Name: "Bob Smit},...]"` | Y |
| ValueKey | Object property key that assigns each options value attributes value. Example: `...`. The value must not be `undefined` or `null`. | Y
| TextKey | Object property key that assigns each option's text value. Example: `{TextKey.Value}>...`. The value must not be `undefined` or `null`. | Y
| DefaultText | Prepends a new option element and assigns the option's text value | N
| DefaultValue | Sets the prepended option element's value. | N
| SelectedOptionByValue | Sets an option element to 'selected' by a matching option value attribute | N