Refresh DataSource
Hello Everyone
Attachment: BlazorApp9_4766ebb3.zip
I'm currently using the ListBox component with an ICollection<> that comes from EF Core. I also saw that you suggest to use Observerable Collections but due my entities this is not possible and a DTO is in this project against the guidelines. So how can I achieve a refresh of the list through code? In many other SJ2 Component it's just enaugh to call `this.state.hasChanged()` which doesn't work here if also tried the two methods `.Refresh()` and `.DataBind()`
@page "/"
@using Syncfusion.EJ2.Blazor.DropDowns
@using Syncfusion.EJ2.Blazor.Buttons
<EjsListBox TValue="string[]" DataSource="@Vehicles" ModelType="@typeof(VehicleData)" @ref="ListBoxObj">
<ListBoxFieldSettings Text="Text" Value="Id" />
<ListBoxTemplates>
<ItemTemplate>
<p>@((context as VehicleData).Text)</p>
</ItemTemplate>
</ListBoxTemplates>
</EjsListBox>
<EjsButton CssClass="e-btn" Content="Modify data" @onclick="modifyData"></EjsButton>
@code {
EjsListBox<string[]> ListBoxObj;
public ICollection<VehicleData> Vehicles = new List<VehicleData> {
new VehicleData { Text = "Hennessey Venom", Id = "Vehicle-01" },
new VehicleData { Text = "Bugatti Chiron", Id = "Vehicle-02" },
new VehicleData { Text = "Bugatti Veyron Super Sport", Id = "Vehicle-03" },
new VehicleData { Text = "SSC Ultimate Aero", Id = "Vehicle-04" },
new VehicleData { Text = "Koenigsegg CCR", Id = "Vehicle-05" },
new VehicleData { Text = "McLaren F1", Id = "Vehicle-06" },
new VehicleData { Text = "Aston Martin One- 77", Id = "Vehicle-07" },
new VehicleData { Text = "Jaguar XJ220", Id = "Vehicle-08" }
};
public class VehicleData
{
public string Text { get; set; }
public string Id { get; set; }
}
private void modifyData()
{
Vehicles.Remove(Vehicles.First());
Vehicles.Add(new VehicleData {Text = "Ferrari LaFerrari", Id = "Vehicle-09"});
ListBoxObj.Refresh();
ListBoxObj.DataBind();
}
}
Attachment: BlazorApp9_4766ebb3.zip
SIGN IN To post a reply.
5 Replies
SR
Sergio Ramos
February 21, 2020 07:23 AM UTC
Just found out that refresh only not works templates are used. Could you please fix and and provide me a workaround until then?
SR
Sergio Ramos
February 25, 2020 02:28 PM UTC
Do you have any news here?
SD
Saranya Dhayalan
Syncfusion Team
February 27, 2020 02:24 PM UTC
Hi Sergio,
We deeply regret the inconvenience caused.
We have checked your reported issue, we confirmed this is issue we have logged the defect report “Add Items is broken when using ListboxTemplates”. This fix will be available in our Essential studio 2020 volume 1 release. You can track the status of this defect using below link from our feedback portal,
Feedback link: https://www.syncfusion.com/feedback/12260/add-items-is-broken-when-using-listboxtemplates
Regards,
Saranya D
SR
Sergio Ramos
February 28, 2020 08:48 AM UTC
Hi Saranya
Thank you for your response. Do you have an estimated date when the Essential studio 2020 volume 1 will be released?
Kind regards,
Sergio
SD
Saranya Dhayalan
Syncfusion Team
March 2, 2020 04:32 AM UTC
Hi Sergio
Welcome
We would like to let you know that our Essential studio 2020 volume 1 release which has been scheduled to be rolled out in the last week of March. We appreciate your patience until then.
Regards,
Saranya D
SIGN IN To post a reply.
- 5 Replies
- 2 Participants
-
SR Sergio Ramos
- Feb 21, 2020 07:04 AM UTC
- Mar 2, 2020 04:32 AM UTC