Scheduler dataBound event being fired multiple times

1 Answer 166 Views
Scheduler
AGB
Top achievements
Rank 1
Iron
AGB asked on 07 Jan 2023, 02:42 PM

Hi Guys,

I have just noticed an issue with the Scheduler component whereby the dataBound event is constantly being fired during resize events.

To illustrate the problem run the following dojo

https://dojo.telerik.com/uCaQOcEX

and then resize the browser window and you will see multiple 'dataBound' messages hitting the console.log

Running a similar test with the Grid component for comparison

https://dojo.telerik.com/ifoHEDUd

does not cause these multiple dataBound events on resize.

Therefore I suspect this is not the expect behaviour of the Scheduler component but a bug within the code.

Please advise.

Regards
Alan

       
AGB
Top achievements
Rank 1
Iron
commented on 08 Jan 2023, 02:14 PM

Further investigations show the dataBinding event also gets called multiple times on resize.
AGB
Top achievements
Rank 1
Iron
commented on 09 Jan 2023, 04:44 PM

Trawling through the source code (kendo.scheduler.js) the problem stems from within the function

    resize: function(force) {...}

Which then calls

    refresh: function(e) {...}

Within this function we have calls to

    this.trigger("dataBinding")
    view.render(this._data); 
    this.trigger("dataBound");

These three calls just seem unnecessary when all you have done is resized the browser window and haven't changed any of the data.

1 Answer, 1 is accepted

Sort by
0
Martin
Telerik team
answered on 11 Jan 2023, 02:07 PM

Hello, Alan,

The behaviour is expected because the Scheduler does not have a fixed width. Thus, on resize, it changes its width to fit the screen so the events also need to be re-rendered which also causes the data to be bound again.

Let me know if that makes sense.

Regards,
Martin
Progress Telerik

Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.

AGB
Top achievements
Rank 1
Iron
commented on 12 Jan 2023, 08:57 AM

Hi Martin

Thanks for confirming this is expected behaviour, but after years working with the grid component it was a bit of a shook to see the scheduler constantly being dataBound without any data updates being made, which was then triggering my code when it wasn't expected.

Now that I'm aware of the situation I have coded things accordingly.

Perhaps a note within the documentation to point out that resizing the browser will also trigger the dataBinding & dataBound events would help clarify the situation for other users which might hit this problem in the future.

Regards
Alan

Martin
Telerik team
commented on 16 Jan 2023, 04:25 PM

Thank you for the feedback, Alan, we will consider adding a note in the documentation.
Tags
Scheduler
Asked by
AGB
Top achievements
Rank 1
Iron
Answers by
Martin
Telerik team
Share this question
or