Skip to content

Settings and activity

1 result found

  1. 1 vote
    Vote

    We're glad you're here

    Please sign in to leave feedback

    Signed in as (Sign out)
    You have left! (?) (thinking…)
    How important is this to you?

    We're glad you're here

    Please sign in to leave feedback

    Signed in as (Sign out)
    An error occurred while saving the comment
    Shaya commented  · 

    I'm using this for now:

    ```
    class MySelectBox : SelectBox{
    public MySelectBox(SelectBoxKind kind, object[] options, List<int> selectedIndexes) : base(kind, options)
    {
    var _setSelectedIndexes = @"function getSelectedIndexes(id, indexes) {
    var selectOptions = document.getElementById(id).options;
    indexes.forEach(function(i) {if(!selectOptions[i]) return; selectOptions[i].selected = true});
    }";
    HtmlElement.InvokeScript("eval", $"({ _setSelectedIndexes})('{HtmlElement.ID}', [{string.Join(",", selectedIndexes)}])");
    }
    }
    ```

    Shaya shared this idea  ·