jQWidgets Forums
jQuery UI Widgets › Forums › Grid › Problem with the destroy method
Tagged: datagrid, grid, grid destroy, gridview, javascript grid
This topic contains 6 replies, has 2 voices, and was last updated by xrxss15 13 years, 2 months ago.
-
Author
-
Hi,
I did setup a page with a slider and grid widget. When I destroy the grid and afterwards move the slider, it doesn’t stop following the mouse pointer. See the following example code. I am using FF 10.0.1
Regards,
xrxss15EDIT: I can’t paste my example page into this post. So here is only the javascript code.
$(document).ready
( function()
{
var jqxTheme = getTheme();$('#slider').jqxSlider({ theme: jqxTheme, mode: 'fixed', tooltip: true });
var columns = [{ text: 'one', datafield: 'one', width: 100 }, { text: 'two', datafield: 'two', width: 100 }];
$("#list").jqxGrid({ source: { data: [{one:' ', two: ' '}], datatype: 'json' }, columns: columns });$("#list").jqxGrid('destroy');
}
)
The page simply contains two divs with ids ‘slider’ and ‘list’.
Hi xrxss15,
I have tried the code you sent us and I confirm the issue. It will be fixed for the next version which will be this week. As a workaround, I suggest you to use the following: $(“#list”).remove();
Best Regards,
Peter Stoevhttp://www.jqwidgets.com
jQWidgets TeamHi Peter,
I will check the new version as soon as it is available.
Thanks for suggesting a workaround. I am using $(“#list”).remove() already, but I am wondering if it will free up all the memory.
Regards,
xrxss15Hi xrxss15,
We’ve just uploaded the new version. You can download it from our Downloads page. There are also some breaking changes in the Grid and I suggest you to take a look at the “Release Notes” before upgrading.
Best Regards,
Peter Stoevhttp://www.jqwidgets.com
jQWidgets TeamHi Peter,
i’ve downloaded the new version and adjusted my code to your changes. I can confirm that the destroy method doesn’t break the slider anymore.
But I am still having an issue with the destroy method. I can’t re-create the grid in the same node after destroying it:
$(document).ready
( function()
{
var jqxTheme = getTheme();$(‘#slider’).jqxSlider({ theme: jqxTheme, mode: ‘fixed’, tooltip: true });
var columns = [{ text: ‘one’, datafield: ‘one’, width: 100 }, { text: ‘two’, datafield: ‘two’, width: 100 }];
$(“#list”).jqxGrid({ source: { data: [{one:’ ‘, two: ‘ ‘}], datatype: ‘json’ }, columns: columns });$(“#list”).jqxGrid(‘destroy’);
$(“#list”).jqxGrid({ source: { data: [{one:’ ‘, two: ‘ ‘}], datatype: ‘json’ }, columns: columns });
}
)Regards,
xrxss15Hi xrxss15,
It will be not possible to create the Grid after destroying it because the ‘destroy’ method completely destroys the Grid and removes it from the DOM tree i.e there’s no ‘list’ node anymore after calling the ‘destroy’ method. If you want to create a Grid, you need to first add a new element, then selection it and finally call the jqxGrid constructor.
Best Regards,
Peter Stoevhttp://www.jqwidgets.com
jQWidgets TeamAh, I didn’t realize that you are destroying the node itself.
Thanks for clarifying.
Regards,
xrxss15 -
AuthorPosts
You must be logged in to reply to this topic.