ListView selected all rows when dialog closes

I've got a list view defined ...


<SfListView DataSource="@GetKeys()" ShowHeader="true" HeaderTitle="Keys">
    <ListViewFieldSettings TValue="RedisKey"></ListViewFieldSettings>
    <ListViewTemplates TValue="RedisKey">
        <Template>
            @{
                var currentItem = context.ToString();
                <div class="rowitem">
                    <div>@context</div>
                    <div>
                        <span class="rowitem-icon oi oi-eye icon-view" title="View cache content" alt="View cache content" @onclick="(e => OnSelect(currentItem))"></span>
                        <span class="rowitem-icon oi oi-trash icon-delete" title="Delete cache content" alt="Delete cache content"></span>
                    </div>
                </div>
            }
        </Template>
    </ListViewTemplates>
</SfListView>


TheOnSelect method opens a modal dialog...


privatevoidOnSelect(string item)
{
dialogHeader = item;
isDialogVisible =true;
}

But, when the dialog is closed, all of the listview items are selected...


Also the screen scrolls to the bottom of the list.

Any suggestions?


1 Reply

SS Sivakumar ShunmugaSundaram Syncfusion Team May 20, 2022 11:01 AM UTC

Hi Stuart,


Greetings from Syncfusion support.


We have validated your reported query in the Blazor ListView component. We suspect that you have to set the same Id for all the list items in the ListView component. So while closing the dialog component all the list items are select in your application and also this is the reason for screen scrolls to the bottom of the list. To overcome the issue, We suggest you to set a unique Id for each list item in the ListView component and screen does not scrolls to the bottom of the list. We have attached the sample for your reference.


Sample: https://www.syncfusion.com/downloads/support/directtrac/general/ze/WebApplication1-186799893.zip


Please check the attached sample and get back to us if you need any further assistance.


Regards,

Sivakumar S


Loader.
Up arrow icon