sfListView not getting previously selected data

 <div class="d-flex flex-wrap">
            @for (int i = 0; i < Permissions.Count; i++)
            {
                var c = i;
                var per = Permissions.ElementAt(i);
                <div class="col-3">
                    <h4>@per.Key</h4>
                    <SfListView DataSource="@per.Value" ShowCheckBox="true" @ref="@_lists[c]">
                        <ListViewFieldSettings Id="Id" Text="Permission" IsChecked="IsChecked"></ListViewFieldSettings>
                    </SfListView>
                </div>
            }
        </div>

@code
{
    private readonly SfListView<PermissionViewModel>[] _lists = new SfListView<PermissionViewModel>[PermissionsMessage.Permissions.Count];

    private async Task<List<string>> GetSelectedValues()
    {
        StateHasChanged();
        var list = new List<string>();
        foreach (var sfListView in _lists)
        {
            var selected = await sfListView.GetSelectedItems();
            var x = sfListView.DataSource.Where(x => x.IsChecked).Select(x => x.Id);
            foreach (var l in x)
            {
                Console.WriteLine(l);
            }
            Console.WriteLine(sfListView.DataSource.Count());
            if (selected.Data != null)
            {
                list.AddRange(selected.Data.Select(x =>
                {
                    Console.WriteLine(x.Id);
                    return x.Id;
                }));
            }
        }

        return list;
    }
}


When the data is loaded from the backed where IsChecked is set
The user makes some some selections
sfListView.GetSelectedItems() method is called
Only the newly selected value is returned. The previous selections are not returned, even though the UI shows the value as checked.   


2 Replies 1 reply marked as answer

SR srivatsa July 7, 2020 05:53 AM UTC

The issue is fixed.

The reported issue occurred in the previous version (18.1.0.59) but got resolved in the latest version (18.2.0.44) which is released today morning.

Thanks to the support team :-)

Marked as answer

SP Sowmiya Padmanaban Syncfusion Team July 7, 2020 06:03 AM UTC

Hi Srivatsa,  
  
We are happy to hear that your issue has been resolved. Please contact us, if you need any help from us. 
  
Regards,  
Sowmiya.P 


Loader.
Up arrow icon