-
Notifications
You must be signed in to change notification settings - Fork 5.3k
Description
Problem Description
I'm developing a stock selection dropdown component in OpenBB Workspace with type: "endpoint" and optionsEndpoint configuration, but I
found that the endpoint is only called during initial component render, not when users type search keywords.
Current Configuration
{
"paramName": "symbol",
"type": "endpoint",
"value": "600519.SH",
"label": "Select Stock",
"placeholder": "Search and select stock",
"required": True,
"optionsEndpoint": "/stock_search_options",
"optionsParams": {
"query": "$symbol",
},
"enableSearch": True,
"style": {
"popupWidth": 450
}
}Endpoint Implementation
@router.get("/stock_search_options")
async def stock_search_options(
query: str = Query("", description="Search keyword"),
x_user_id: str = Header(alias="X-User-ID", default="")
):
# Search stocks based on query parameter
if not query.strip():
# Return default stock list
return default_stocks
# Search using query
search_results = await search_symbols_data_only(query)
return format_options(search_results)Behavior
Expected Behavior
- When users type in the dropdown, it should trigger a request to /stock_search_options?query=user_input
- The endpoint should receive the query parameter and return filtered options
- The dropdown should update in real-time with search results
Actual Behavior
- Only calls /stock_search_options (without query parameter) when component first renders
- No new requests are made when users type search keywords
- Real-time search functionality doesn't work
Questions
- Does OpenBB Workspace support real-time search for dropdowns?
- If supported, what's the correct configuration?
- Is enableSearch an officially supported parameter?
- Are there alternative ways to implement dynamic dropdown search?
Environment
- OpenBB Platform: local
- OpenBB Workspace
- Backend: FastAPI + Python
Reference Documentation
I referenced the documentation: openbb-docs/content/workspace/widget-parameters/advanced-dropdown.md, but couldn't find specific instructions for real-time search functionality.
Additional Context
The current implementation only loads options once on initial render. We need the dropdown to dynamically fetch filtered options based on user input for a better user experience, especially when dealing with large datasets like stock symbols.
Any guidance or documentation on the correct configuration format would be greatly appreciated!