Approved
Last Updated: 16 Sep 2019 14:27 by ADMIN
Scheduled for 2019.R3

Taken from the StackOverflow question 'Why does 'show' event on Kendo View fire twice?' https://stackoverflow.com/questions/56266538/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>
The OP's dojo sample is set to run against the latest version of kendo; when running against the previous 2019 R1 SP1 (2019.1.220) the sample behaves as expected hence this appears to be a bug introduced in release 2019 R2 (2019.2.514)