This is a migrated thread and some comments may be shown as answers.

Help on Kendo UI - Scheduer

1 Answer 45 Views
Scheduler
This is a migrated thread and some comments may be shown as answers.
Angelo
Top achievements
Rank 1
Angelo asked on 02 Dec 2016, 08:22 AM

Hi,

 

I'm trying to follow the example illustrated in http://dojo.telerik.com/OwUCE/44 about adding a custom button in the toolbar part of the Scheduler.

However i noticed that if you resize the browser window multiple times, the button (hence the "dataBound" event gets fired multiple times) therefore 

we get a lot of new buttons. Is there a way to force that this button is only created ONCE?

 

 

1 Answer, 1 is accepted

Sort by
0
Veselin Tsvetanov
Telerik team
answered on 05 Dec 2016, 03:19 PM
Hello Angelo,

You could add an additional check to the event handler and avoid adding a new button, if one has already been added to the toolbar:
dataBound: function() {
  if (this.view().name !== "agenda" && this.wrapper.find('.event-status-not-started').length === 0 )
   $("<button class='event-status-not-started k-button' > Not Started</button >")
    .appendTo(this.wrapper.find(".k-scheduler-toolbar"))
    .bind("click", function() { alert("Some message"); });
  }
},

Here you will find a modified version of the sample sent.

Regards,
Veselin Tsvetanov
Telerik by Progress
Kendo UI is ready for Visual Studio 2017 RC! Learn more.
Tags
Scheduler
Asked by
Angelo
Top achievements
Rank 1
Answers by
Veselin Tsvetanov
Telerik team
Share this question
or