Peter Byrne
Peter Byrne

Reputation: 133

Why does 'show' event on Kendo View fire twice?

If a Kendo View is rendered into a Layout (using layout.showIn()), the show event for the view fires twice. Interestingly, if the view is rendered directly into a DOM element (using view.render()) the event is only fired once, like it's supposed to.

The code is pretty well copied from the Kendo UI Dojo thingee. I wonder if can you run this : https://dojo.telerik.com/AkOwiMAZ/2

<div id="app"></div>
<script>
var foo = new kendo.View("<span>Foo</span>", { hide: function() { console.log("Foo is hidden now"); }, show: function() { console.log( "Foo is shown now"); }});

var layout = new kendo.Layout("<header>Header</header><section id='content'></section><footer></footer>");

// Creating the layout, and using the showIn method to render the view
// is where I'm having the issue (2 'show' events fire)
layout.render($("#app"));
layout.showIn("#content", foo);
//
// But this way works fine (rendering directly to a DOM element) (just // one 'show' event fires)
//foo.render('#app');
</script>

I would like the 'show' event to fire once, as it is only shown once :)

Upvotes: 3

Views: 1159

Answers (1)

Joe Glover
Joe Glover

Reputation: 1026

This appears to be a bug introduced into the latest 2019 R2 kendo release (2019.2.514). Switching your sample to use the previous 2019 R1 SP1 (2019.1.220) version causes it to behave as expected https://dojo.telerik.com/AkOwiMAZ/5

Telerik usually release a service pack roughly a month after each quarterly release; we've raised a bug report with them, so there's a chance it might be fixed in 2019 R2 SP1. Otherwise, I guess your best bet is stick with 2019.1.220 for the time being. Hope this helps.

Edit: Confirmed as being fixed in 2019 R3 (2019.3.917) release.

Upvotes: 2

Related Questions