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

Orphaned elements / Memory Leak in Grid using a filter

1 Answer 132 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Christopher Ronak
Top achievements
Rank 1
Christopher Ronak asked on 09 Dec 2012, 07:26 PM
Hello, either there is a memory leak with grid's (when used with a filter) or I'm using it wrong.  I'm hoping that I'm using it wrong!  So I've created a jsfiddle that demonstrates the problem below.  The problem seems to be that when i reload the grid (by removing the grid first) it seems to leave the hidden k-filter-menu behind in the dom.  If you keep on clicking reload you will eventually run out of memory.  You can best see the problem if you load up firefox + firebug.  Inspect the grid and click reload, you'll notice the orphaned filter forms keep on adding up.

http://jsfiddle.net/nZ7j3/5/

ps. i didn't bother create a fiddle for it, but the same problem exists for any kendo object that maintains a hidden form element (i'm generalizing but i've definitely seen it on the DropDownList, ComboBox)

1 Answer, 1 is accepted

Sort by
0
Christopher Ronak
Top achievements
Rank 1
answered on 09 Dec 2012, 08:51 PM
Did some more digging and found a solution.  The grid seems to clean itself when you call destroy so the only problem is hooking to a remove dom event to make the call.  A stackoverflow question seems to indicate a good approach

http://stackoverflow.com/questions/2200494/jquery-trigger-event-when-an-element-is-removed-from-the-dom/10172676#10172676

i've modified the fiddle, employing the suggestion and it seems to work well.  I'll be using this unless there's a better solution from Telerik.

http://jsfiddle.net/A4wQn/2/

Tags
Grid
Asked by
Christopher Ronak
Top achievements
Rank 1
Answers by
Christopher Ronak
Top achievements
Rank 1
Share this question
or