1
0
mirror of https://github.com/s00500/ESPUI.git synced 2024-11-22 04:00:55 +00:00

Realign with upstream

This commit is contained in:
Ian Gray 2022-01-03 15:39:48 +00:00
parent 0ab401c3b1
commit 7e5331d54f

View File

@ -1035,17 +1035,21 @@ Control* ESPUIClass::prepareJSONChunk(AsyncWebSocketClient* client, Control* con
if (control->elementStyle != 0) if (control->elementStyle != 0)
item["elementStyle"] = String(control->elementStyle); item["elementStyle"] = String(control->elementStyle);
if (control->parentControl != Control::noParent) { if (control->parentControl != Control::noParent)
{
item["parentControl"] = String(control->parentControl); item["parentControl"] = String(control->parentControl);
} }
// special case for selects: to preselect an option, you have to add // special case for selects: to preselect an option, you have to add
// "selected" to <option> // "selected" to <option>
if (control->type == ControlType::Option) { if (control->type == ControlType::Option)
if (ESPUI.getControl(control->parentControl)->value == control->value) { {
if (ESPUI.getControl(control->parentControl)->value == control->value)
{
item["selected"] = "selected"; item["selected"] = "selected";
} }
else { else
{
item["selected"] = ""; item["selected"] = "";
} }
} }