jQWidgets Forums

jQuery UI Widgets Forums Grid Problem with the destroy method

This topic contains 6 replies, has 2 voices, and was last updated by  xrxss15 13 years, 2 months ago.

Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
  • Problem with the destroy method #2168

    xrxss15
    Member

    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,
    xrxss15

    EDIT: 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’.

    Problem with the destroy method #2175

    Peter Stoev
    Keymaster

    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 Stoev

    http://www.jqwidgets.com
    jQWidgets Team

    Problem with the destroy method #2177

    xrxss15
    Member

    Hi 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,
    xrxss15

    Problem with the destroy method #2204

    Peter Stoev
    Keymaster

    Hi 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 Stoev

    http://www.jqwidgets.com
    jQWidgets Team

    Problem with the destroy method #2218

    xrxss15
    Member

    Hi 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,
    xrxss15

    Problem with the destroy method #2219

    Peter Stoev
    Keymaster

    Hi 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 Stoev

    http://www.jqwidgets.com
    jQWidgets Team

    Problem with the destroy method #2220

    xrxss15
    Member

    Ah, I didn’t realize that you are destroying the node itself.

    Thanks for clarifying.

    Regards,
    xrxss15

Viewing 7 posts - 1 through 7 (of 7 total)

You must be logged in to reply to this topic.