streamdeck-pisamples icon indicating copy to clipboard operation
streamdeck-pisamples copied to clipboard

Initializing Radios and have it reflected in the UI

Open jandolina opened this issue 4 years ago • 1 comments

This sample is kind of awesome, thank you! How do I initialize the state of the radio buttons using the JS and not the HTML?

Here is my html, lifted almost exactly from the sample code.

<div type="radio" class="sdpi-item" id="tickermode">
      <div class="sdpi-item-label">Source</div>
      <div class="sdpi-item-value ">
        <div class="sdpi-item-child">
          <input id="rdio1" type="radio" name="mytickermode" value="crypto">
          <label for="rdio1" class="sdpi-item-label"><span></span>Crypto</label>
        </div>
        <div class="sdpi-item-child">
          <input id="rdio2" type="radio" name="mytickermode" value="stocks">
          <label for="rdio2" class="sdpi-item-label"><span></span>Stocks</label>
        </div>
      </div>
    </div>

I have been working in the connectElgatoStreamDeckSocket function to preload the settings object if certain values are not found.

settings = {"tickermode":"stocks", "mynameinput":"myName"};

and

settings = {"mytickermode":"stocks", "mynameinput":"myName"};

These values make no changes to the UI. How should I set the value so that the UI is updated? What function should I call to update the UI?

jandolina avatar Jun 04 '21 23:06 jandolina

@jandolina if you look into the the plugintemplate you will find a sample how that would work. It uses the old API, but it works fine and should give you an idea how to fill in your data.

tiptronic avatar Jun 11 '21 07:06 tiptronic