Log In Sign Up
HomeExamplesSelect Component: How to Use Data Sources

Select Component: How to Use Data Sources

Category: Examples
The select component supports both single and multiple selection, perfectly replacing native select-single and select-multiple components; it features fuzzy search and auto-completion.

Simple Grouping

The native select element supports hierarchical grouping through the optgroup tag, which can be used directly to create two-level grouping.

Using Complete Structure Trees

When writing data on list nodes:

Using Plain Text Data

Multiple option texts separated by English commas.

Using Script Tags to Pass Data

you can use script tags within the oc-select tag and write the data in standard JavaScript format.

You can also write data directly in HTML format within the target node without using script tags, though this approach is less elegant.

Using Detailed Array Data

When creating instances, the following data properties can be used:

Using Asynchronous JSON Data

Supports loading option data from JSON files, with two supported JSON data structures:

  • Flat JSON array data with id and pId fields (single level hierarchy)
  • Tree-like JSON array data with children property (multi-level hierarchy)

The data must contain at least a label property.

You can click here to download the database SQL file.

New Launch: 20% Off All Products

Unlock all examples and development resources