Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Enhancement: clean destroy #218

Open
@rochejul

Description

@rochejul

Hi,

I have a case where I need to reinstanciate the gridster (on window resize). But I cannot use the destroy method, because it delete the DOM elements.

And we have to clean properly on destroy, because the reinstanciation can inject some problems (drag / drop not managed ...).

If you want, I produce a function to resolve that:

fn.destroy = function(removeDOM) {
$(window).unbind('.gridster');

if (this.drag_api) {
    this.drag_api.destroy();
    this.$el.removeData('drag');
}

this.remove_style_tags();
this.removeData('gridster');

if(removeDOM === undefined || removeDOM === true) {
    this.$el.remove();
}

return this;

};

Cheers

Julien Roche

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions