Answer:
public async Task DisableList() { DataModel data = new DataModel(); data.Id = "list-06"; await this.List.DisableItem(data); } |
Find the sample to disable Blazor ListView Item from here.
I think you'll find the code sample incorrect and the field is "Enable" in the code not "Enabled"
Hi Robin,
Greetings from Syncfusion support.
Based on the shared details, we would like to let you know that you can choose any convenient name for the 'ListView' component's 'Enabled' field value. It will not cause any issues in the 'ListView' component. For example, we have mapped the name 'ListViewEnabled' for the 'Enabled' field value, and it is working as expected without any issues.
Refer to the below code snippets.
|
<SfButton id="disable" Content="Disable Item" OnClick="DisableList"></SfButton> <SfListView DataSource="@Data" @ref="List" TValue="DataModel"> <ListViewFieldSettings TValue="DataModel" Id="Id" Text="Text" Enabled="ListViewEnabled"></ListViewFieldSettings> </SfListView>
@code { SfListView<DataModel> List; private DataModel[] Data = { new DataModel { Text = "ArtWork", Id = "list-01",ListViewEnabled=true }, new DataModel { Text = "Abstract", Id = "list-02",ListViewEnabled=true }, new DataModel { Text = "Modern Painting", Id = "list-03", ListViewEnabled=false }, new DataModel { Text = "Ceramics", Id = "list-04",ListViewEnabled=true }, new DataModel { Text = "Animation Art", Id = "list-05",ListViewEnabled=true }, new DataModel { Text = "Oil Painting", Id = "list-06",ListViewEnabled=true } }; class DataModel { public string Text { get; set; } public string Id { get; set; } public bool ListViewEnabled { get; set; } }
… } |
For your reference, we have attached the sample and screenshot.
Sample: https://blazorplayground.syncfusion.com/LtVTthiRAKdEjomt
Screenshot:
|
|
Check out the attached sample and let us know if you need any further assistance.
Regards,
Prasanth Madhaiyan.