alfajango / jquery-dynatable

A more-fun, semantic, alternative to datatables
http://www.dynatable.com
Other
2.77k stars 363 forks source link

any way to reference a specific row of data? #256

Open uotw opened 7 years ago

uotw commented 7 years ago

Hi, using dynatable in the traditional way. I have a table that has been pre-generated from multiple sql queries. I would like to dynamically hide a specific row of the dataset when the user clicks the trashcan on that row. With a traditional table I just set the and then just run $('#myrowid').fadeOut() while I send a php ajax call to delete my database record. However, it appears that my row ids are getting stripped in the conversion to JSON. Is there any way to allow those to persist, or can I somehow find that record in the JSON, delete it and then run a dynatable.process();?

I did find this thread, but I didn't see a final solution. https://github.com/alfajango/jquery-dynatable/issues/25

uotw commented 7 years ago

I was able to get the row to go disappear using $().closest('tr').remove(), and it clearly gets removed from the DOM, but then it comes back when I sort any row. I assume it is because the record still exists in the JSON object. If I call dynatable.update() or dynatable.process() after deleting it from the DOM, I get an error thrown that "dynatable.update [or process] is not a function." Here's how I have dynatable defined:

dynatable = $('#myarchives').dynatable({ features: { paginate: true, recordCount: true, sorting: true } });