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

Splitter script error on window resize on IE 9 - when splitter is removed from DOM and added again dynamically

1 Answer 142 Views
Splitter
This is a migrated thread and some comments may be shown as answers.
Shravan
Top achievements
Rank 1
Shravan asked on 11 Oct 2013, 11:16 AM
Hi,

In a MVC4 application I am working, I have some menu links, clicking on these links, I load the relevant page as an ajax partial view below the menu links.
One of the partial views contains a splitter. When I load this  partial view containing splitter and navigate to other partial views clicking on other links, and if I come back to the view with the splitter partial view - on window resize the scripts throw an error saying that 'offsetWidth' is null. This happens on IE 9.0 only

Environment
Browser: IE 9.0
Kendo Version: 2013.2.918.340

I have put up a simple mvc4 application demonstrating that.
Steps to reproduce :
1) Click on the link 'Load splitter view below' (Loads a view with splitter beneath the link)
2) Click on the link 'Load non splitter view below' (Replaces the splitter view with a non splitter view)
3) Click on the link 'Load splitter view below' (Loads the splitter view again)
4) Resize the browser window, then the script breaks saying 'offsetWidth' is null. Resizing the window is triggering resize event on splitter, where it is breaking

Can you please see if this is a real issue or if I am missing out anything here ?

1 Answer, 1 is accepted

Sort by
0
Accepted
Dimo
Telerik team
answered on 11 Oct 2013, 01:58 PM
Hello Shravan,

For some reason I am not able to run your project due to missing references, but I got the idea by looking at the code.

It is important to destroy all Kendo UI widgets in a container, which will be removed or its content will be replaced. Otherwise existing event handlers may cause unexpected side effects, and/or you can have memory leaks

Splitter destroy:
http://docs.kendoui.com/api/web/splitter#methods-destroy

Kendo destroy:
http://docs.kendoui.com/api/framework/kendo#methods-destroy

The first method may be sufficient, but I recommend you to use the second one, which will destroy all Kendo UI widget instances found inside the specified container.

Regards,
Dimo
Telerik
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
Tags
Splitter
Asked by
Shravan
Top achievements
Rank 1
Answers by
Dimo
Telerik team
Share this question
or