Kendos,
I'm writing a fairly complex app using the framework. The app uses a page input form with many complex elements. This page is fetched via ajax using the application navigate methods.
The issue is that this appends the main document. So each time you call a slightly different version of this page (edit, etc) it fetches the HTML via Ajax and appends it to the current document.
This not only vastly increases the size of the document (and possibly leading to memory issues if the app is open for long enough) but also it confuses the DOM as there are now 2 or more versions of the form, so you get 2 or more copies of ID elements.
I'd like a way to 'clean up' all previously loaded views when fetching a new page. I've managed to fudge this in my code by putting this in the data-init function of the form I'm loading:
But it seems less that optimal and prone to bugs down the road.
Something to consider for a future version?
I'm writing a fairly complex app using the framework. The app uses a page input form with many complex elements. This page is fetched via ajax using the application navigate methods.
The issue is that this appends the main document. So each time you call a slightly different version of this page (edit, etc) it fetches the HTML via Ajax and appends it to the current document.
This not only vastly increases the size of the document (and possibly leading to memory issues if the app is open for long enough) but also it confuses the DOM as there are now 2 or more versions of the form, so you get 2 or more copies of ID elements.
I'd like a way to 'clean up' all previously loaded views when fetching a new page. I've managed to fudge this in my code by putting this in the data-init function of the form I'm loading:
$('div[data-role=view]').each( function( i, elem )
{
if ( $(elem).attr('data-url') && $(elem).attr('data-url') != window.location.hash.replace( /#/, '' ) )
{
$(elem).remove();
}
} );
But it seems less that optimal and prone to bugs down the road.
Something to consider for a future version?