JavaScript UI Libraries & Blazor Components Suite – Smart UI Forums DropDownList EventCallback SelectedIndexesChanged issue (Blazor)

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #102475
    TurricanDE
    Participant

    When you set an event callback for “SelectedIndexesChanged” the dropdown list doesn’t show the new selected entry.

    See the example below:

    @page “/dropdownlist-basic”

    <style>
    /* This is the CSS used in the demo */
    smart-drop-down-list {
    min-height: 35px;
    height: auto;
    width: 300px;
    }
    </style>

    <Example Name=”DropDownList”>
    <DropDownList SelectedIndexes=”selectedIndexes” SelectedIndexesChanged=”OnSelectedIndexChanged”>
    <ListItem Value=”1″>Affogato</ListItem>
    <ListItem Value=”2″>Americano</ListItem>
    <ListItem Value=”3″>Bicerin</ListItem>
    <ListItem Value=”4″>Breve</ListItem>
    <ListItem Value=”5″>Cappuccino</ListItem>
    <ListItem Value=”6″>Cafe Crema</ListItem>
    <ListItem Value=”7″>Cafe Corretto</ListItem>
    <ListItem Value=”8″>Cafe macchiato</ListItem>
    <ListItem Value=”9″>Cafe mocha</ListItem>
    <ListItem Value=”10″>Cortado</ListItem>
    <ListItem Value=”11″>Cuban espresso</ListItem>
    <ListItem Value=”12″>Espresso</ListItem>
    <ListItem Value=”13″>Eiskaffee</ListItem>
    <ListItem Value=”14″>Frappuccino</ListItem>
    <ListItem Value=”15″>Galao</ListItem>
    <ListItem Value=”16″>Greek frappe coffee</ListItem>
    <ListItem Value=”17″>Iced Coffee</ListItem>
    <ListItem Value=”18″>Instant Coffee</ListItem>
    <ListItem Value=”19″>Latte</ListItem>
    <ListItem Value=”20″>Liqueur coffee</ListItem>
    </DropDownList>
    </Example>

    @code {
    private int[] selectedIndexes = new int[] { 0 };

    private void OnSelectedIndexChanged(int[] selectedIndexes)
    {

    }
    }

    #102477
    TurricanDE
    Participant

    I figured it out, you have to set the selected indexes explicitly in the event callback method:

     

    private void OnSelectedIndexChanged(int[] selIndexes)
    {

    selectedIndexes = selIndexes;

    }

     

     

Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.