Compute
Elastic Cloud Server
Huawei Cloud Flexus
Bare Metal Server
Auto Scaling
Image Management Service
Dedicated Host
FunctionGraph
Cloud Phone Host
Huawei Cloud EulerOS
Networking
Virtual Private Cloud
Elastic IP
Elastic Load Balance
NAT Gateway
Direct Connect
Virtual Private Network
VPC Endpoint
Cloud Connect
Enterprise Router
Enterprise Switch
Global Accelerator
Management & Governance
Cloud Eye
Identity and Access Management
Cloud Trace Service
Resource Formation Service
Tag Management Service
Log Tank Service
Config
OneAccess
Resource Access Manager
Simple Message Notification
Application Performance Management
Application Operations Management
Organizations
Optimization Advisor
IAM Identity Center
Cloud Operations Center
Resource Governance Center
Migration
Server Migration Service
Object Storage Migration Service
Cloud Data Migration
Migration Center
Cloud Ecosystem
KooGallery
Partner Center
User Support
My Account
Billing Center
Cost Center
Resource Center
Enterprise Management
Service Tickets
HUAWEI CLOUD (International) FAQs
ICP Filing
Support Plans
My Credentials
Customer Operation Capabilities
Partner Support Plans
Professional Services
Analytics
MapReduce Service
Data Lake Insight
CloudTable Service
Cloud Search Service
Data Lake Visualization
Data Ingestion Service
GaussDB(DWS)
DataArts Studio
Data Lake Factory
DataArts Lake Formation
IoT
IoT Device Access
Developer Tools
SDK Developer Guide
API Request Signing Guide
Terraform
Koo Command Line Interface
Content Delivery & Edge Computing
Content Delivery Network
Intelligent EdgeFabric
CloudPond
Intelligent EdgeCloud
Solutions
SAP Cloud
High Performance Computing
Media Services
Media Processing Center
Video On Demand
Live
SparkRTC
MetaStudio
Developer Services
ServiceStage
CodeArts
CodeArts PerfTest
CodeArts Req
CodeArts Pipeline
CodeArts Build
CodeArts Deploy
CodeArts Artifact
CodeArts TestPlan
CodeArts Check
CodeArts Repo
Cloud Application Engine
Huawei Cloud Astro Canvas
Huawei Cloud Astro Zero
CodeArts Governance
Storage
Object Storage Service
Elastic Volume Service
Cloud Backup and Recovery
Storage Disaster Recovery Service
Scalable File Service Turbo
Scalable File Service
Volume Backup Service
Cloud Server Backup Service
Data Express Service
Dedicated Distributed Storage Service
Containers
Cloud Container Engine
SoftWare Repository for Container
Application Service Mesh
Ubiquitous Cloud Native Service
Cloud Container Instance (CCI)
Databases
Relational Database Service
Document Database Service
Data Admin Service
Data Replication Service
GeminiDB
GaussDB
Distributed Database Middleware
Database and Application Migration UGO
TaurusDB
Middleware
Distributed Cache Service
API Gateway
Distributed Message Service for Kafka
Distributed Message Service for RabbitMQ
Distributed Message Service for RocketMQ
Cloud Service Engine
Multi-Site High Availability Service
EventGrid
Dedicated Cloud
Dedicated Computing Cluster
Business Applications
Workspace
ROMA Connect
Message & SMS
Domain Name Service
Edge Data Center Management
Meeting
AI
Face Recognition Service
Graph Engine Service
Content Moderation
Image Recognition
Optical Character Recognition
ModelArts
ImageSearch
Conversational Bot Service
Speech Interaction Service
Huawei HiLens
Video Intelligent Analysis Service
Cloud Transformation
Well-Architected Framework
Cloud Adoption Framework
Others
Product Pricing Details
System Permissions
Console Quick Start
Common FAQs
Instructions for Associating with a HUAWEI CLOUD Partner
Message Center
Security & Compliance
Security Technologies and Applications
Web Application Firewall
Host Security Service
Cloud Firewall
SecMaster
Anti-DDoS Service
Data Encryption Workshop
Database Security Service
Cloud Bastion Host
Data Security Center
Cloud Certificate Manager
Edge Security
Blockchain
Blockchain Service
Web3 Node Engine Service
MacroVerse aPaaS
KooMessage
KooPhone
KooDrive
On this page
Help Center/ Huawei Cloud Astro Zero/ FAQs/ Application Frontend Development/ How Do I Set a Drop-Down List with Filtering Function on a Standard Page?

How Do I Set a Drop-Down List with Filtering Function on a Standard Page?

Updated on 2025-03-20 GMT+08:00

Description

How do I set a drop-down list to display filtered values based on the input field, instead of all values?

For example, an offering has three states: on-shelf, off-shelf, and test. Currently, the options in the drop-down list box A on the offering navigation bar are offerings in all states. As a result, a large amount of dirty data is generated and correct data cannot be selected. In this case, add an input box B. Then you can filter the options in the drop-down list box A based on the value entered in the input box B. Enter Online in the input box B. Only offering options in Online state are displayed in the drop-down list box A, as shown in Figure 1.

Figure 1 Implementation result

Solution

Set the input widget and drop-down list box widget on the standard page to customize the options in the drop-down list box.

  1. Drag an input widget to the work area of the standard page, and click in the property setting area to bind the data.

    Figure 2 Dragging the input box

  2. Click New, set Model Name to Key, select Custom, and click Next.

    Figure 3 Configuring a custom model

  3. Click Add Node, add the Value field, set the field type to Text, and click Next.

    Figure 4 Adding a node

  4. In this example, you do not need to add a method. Click OK.
  5. In the Select Model dialog box, select the Value field and click OK.

    Figure 5 Selecting the field

  6. Select the input widget. On the Events tab page, click next to on-blur.

    Figure 6 Setting an event

  7. In the code editing area, edit the event code and click Create.

    Figure 7 Custom JavaScript code

    The offering object Namespace__Product__CST exists in the system and contains the name and Namespace__status__CST fields, which indicate the offering name and offering state, respectively. This event code is used to obtain the name of the offering whose value in the input box is the same as the offering state and return the offering name to the list.

    // Current widget
    // let _component = context.$component.current 
    
    // Obtain the data model named ${modelName}.
    // let _model = context.$model.get('${modelName}') 
    // debugger 
    context.object("Namespace__Product__CST").query({condition:{ 
        conjunction: "AND", 
        conditions: [ 
            { field: "Namespace__status__CST", operator: "eq", value: context.$model.get("Key").getData().value } 
        ] 
    }}).then(function (resp) { 
        context.$model.get("list").setData(resp.map(function (o) { 
            return { 
                display: o.name, 
                value: o.id 
            } 
        })); 
    });

  8. Click in the upper part of the page to save the page.
  9. Drag a drop-down list box widget to the working area of the standard page. On the Properties tab page, click + next to Property Binding, and then click .

    Figure 8 Dragging a drop-down list box widget

  10. Refer to 2 to 6, create a data model named list, add the display and name fields to the model, select list, and click OK.

    Figure 9 Adding the list model

  11. Click in the upper part of the page to save the page.
  12. Click to preview the standard page.

We use cookies to improve our site and your experience. By continuing to browse our site you accept our cookie policy. Find out more

Feedback

Feedback

Feedback

0/500

Selected Content

Submit selected content with the feedback