1rosehip / jplist

jPList jQuery Data Grid Controls is a flexible jQuery plugin for sorting, pagination and filtering of any HTML structure (DIVs, UL/LI, tables, etc).
http://jplist.com
Other
437 stars 177 forks source link

Destroy a jplist instance #206

Closed caneta closed 8 years ago

caneta commented 8 years ago

I would like to destroy a jplist instance: is there a way to realize this? Thanks

1rosehip commented 8 years ago

Hi, Unfortunately this is still not implemented, but it's on my roadmap.

Thanks

caneta commented 8 years ago

Ok, thank you!

1rosehip commented 8 years ago

Could you please explain what is your use case for destroying the plugin instance? In which cases in could be helpful for you? I've check recently that to destroy it I should implement destroy method in almost every jplist addon, and it is a lot of additional code and work. So I'm considering now if it's worth these additional overhead.

caneta commented 8 years ago

I search for a 'destroy' method because I reload the list dynamically after an Ajax call.

  1. I initialize jplist on a static html list
  2. I modify some element in the list, imagine a list of boxes with input text fields and checkboxes
  3. I submit changes for the whole list to the server via Ajax
  4. The server returns the new list updated
  5. I remove the previous list items from the DOM (jplist still attached to my list container!)
  6. When I try to re-add the new list inside my container the plugin breaks

Maybe there are other ways to achieve my goal, but at the time of my first post a 'destroy' method would had been useful...

1rosehip commented 8 years ago

Thank you for the explanation. I guess it's possible to use jPList API to remove / add items instead:

http://jplist.com/documentation/api-add-one-item http://jplist.com/documentation/api-add-range-of-items http://jplist.com/documentation/api-remove-one-item http://jplist.com/documentation/api-remove-range-of-items

caneta commented 8 years ago

Ok, maybe this is a better approach. Thanks!

1rosehip commented 8 years ago

You're welcome!