s00500 / ESPUI

A simple web user interface library for ESP32 and ESP8266
https://valencia.lbsfilm.at/midterm-presentation/
Other
923 stars 174 forks source link

How to remove an option into a select input.. #191

Closed nodoubtman closed 2 years ago

nodoubtman commented 2 years ago

Hello. How to remove an option into an select input ?

Thanks. Marc.

iangray001 commented 2 years ago

Can't you just remove the Select control with ESPIU.removeControl() and then refresh the UI with jsonReload()?

nodoubtman commented 2 years ago

Thanls for replying :) I want to remove an option which are into the select. I dont find any way to remove it. Thanks. Marc

iangray001 commented 2 years ago

I'm confused. You create a select and its options with:

auto select1 = ESPUI.addControl( ControlType::Select, "Select Title", "Initial Value", ControlColor::Alizarin, tab1, &selectExample );
auto opt1 = ESPUI.addControl( ControlType::Option, "Option1", "Opt1", ControlColor::Alizarin, select1);
auto opt2 = ESPUI.addControl( ControlType::Option, "Option2", "Opt2", ControlColor::Alizarin, select1);

so you can remove then with

ESPIU.removeControl(opt1);
nodoubtman commented 2 years ago

Thanks. I will try it. Marc.

nodoubtman commented 2 years ago

@iangray001 thank you its works :)

Good day. Marc.

iangray001 commented 2 years ago

Awesome, good stuff.