jQWidgets Forums

jQuery UI Widgets Forums Grid Clear is slow

This topic contains 3 replies, has 2 voices, and was last updated by  Peter Stoev 9 years ago.

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
  • Clear is slow #86521

    trinty
    Participant

    Hello,

    What is the difference between calling jqxGrid(‘clear’); and just looping through all rows and deleting them? I’m asking because calling clear is a lot slower

    Clear is slow #86522

    Peter Stoev
    Keymaster

    Hi trinty,

    It depends on the number of rows. Clear removes and re-renders the Grid with empty view.

    Best Regards,
    Peter Stoev

    jQWidgets Team
    http://www.jqwidgets.com

    Clear is slow #86529

    trinty
    Participant

    So this is what we are doing:

    Clear:

    $(jqxGridQueryId).jqxGrid('clear');

    Delete:

    var grid = $(jqxGridQueryId);
    var rowCount = grid.jqxGrid('getdatainformation').rowscount;
    var rowIds = [];
    for (var i = 0; i < rowCount; i++) {
        rowIds[i] = i;
    }
    grid.jqxGrid('deleterow', rowIds);

    Somehow Delete is a lot faster

    Clear is slow #86537

    Peter Stoev
    Keymaster

    Hi trinty,

    Which one is faster depends on the numbers of rows. If in your case one is better than another, then use the one you wish.

    Best Regards,
    Peter Stoev

    jQWidgets Team
    http://www.jqwidgets.com

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

You must be logged in to reply to this topic.