JavaScript UI Libraries & Blazor Components Suite – Smart UI Forums Scheduler [Blazor Scheduler]How to add an item to a scheduler datasource from an event

  • This topic has 1 reply, 2 voices, and was last updated 1 year ago by admin.
Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #103547
    einaradolfsen
    Participant
    Up
    0
    Down

    How to refresh the scheduler after update the datasource List?

    My problem is when the dataSource list is updated the scheduler is not beeing refreshed.

    <Button @onclick=”OnAdd”>Add</Button>

    private void OnAdd(MouseEventArgs args){
    var newEvent = new SchedulerDataSourceWithResource(){ /*set properties here*/};
    dataSource.Add(newEvent);

    StateHasChanged();

    }

    #103553
    admin
    Keymaster
    Up
    0
    Down

    Hi,

    You can use the AddEvent method to add a new Event to the Scheduler.

    ` private void SchedulerReady(Scheduler scheduler)
    {
    DateTime today = DateTime.Today;
    scheduler.AddEvent(new SchedulerDataSource()
    {
    Label = “1Google AdWords Strategy”,
    DateStart = new DateTime(today.Year, today.Month, today.Day, 9, 0, 0),
    DateEnd = new DateTime(today.Year, today.Month, today.Day, 10, 30, 0).AddDays(1),
    AllDay = true,
    BackgroundColor = “#3F51B5”
    });
    }`

    another way is to set the DataSource property of the Scheduler to a new List.

    Best regards,
    Peter Stoev

    Smart UI Team
    https://www.htmlelements.com/

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