jquery-tabledit icon indicating copy to clipboard operation
jquery-tabledit copied to clipboard

How do I reload the table when a new row is added?

Open LibbyJax opened this issue 10 years ago • 8 comments

Is it possible to reload the plugin on a table when a new row is added? Or is there a remove function and then I can reload it fully?

LibbyJax avatar Mar 11 '15 18:03 LibbyJax

Not in the plans, because it will duplicate things. But it's a good idea to create a method to destroy and reload.

markcell avatar Mar 11 '15 21:03 markcell

I agree adding a new row is pretty important for a lot of real-world cases -- if a row can be deleted, why not added?

Great project though. Lightweight and functional for straightforward use.

structure-pm avatar Apr 14 '15 20:04 structure-pm

I think if you can add new row . You can try add a default data to db , then you edit the new row :)

sarla999 avatar Jun 27 '15 08:06 sarla999

Any updates on this? I'm adding rows dynamically to a table and it would be great to have Tabledit parse the table on the fly!

nanexcool avatar Aug 18 '15 22:08 nanexcool

Hey, this still not implemented, @nanexcool have you create a patch so ? ^^'

tarto-dev avatar Sep 29 '16 08:09 tarto-dev

@benftwc Hey did you find a work around for this?

m2jobe avatar Nov 18 '16 18:11 m2jobe

This is how I'm currently working around it: I add a dummy row to the database and then return the entire table in HTML with the dummy row and re-initialize tabledit. This allows the dummy row to be edited as normal. It's a little wonky but it works for an internal tool.

$("#table-account-mapping-add-new").on('click', function() { $.ajax({ type: "GET", url: "/add_new", cache: false, success: function(data, status) { $('#table-account-mapping').html(data); $('#table-account-mapping').Tabledit({ url: '/original_edit_url', columns: { identifier: [0, 'id'], editable: [[1, 'account_number'], [2, 'directory_path']] }, hideIdentifier: true }); }, error: function() { }

LibbyJax avatar Nov 18 '16 19:11 LibbyJax

I tried to fetch the datatable with another Ajax and refresh every second, I can catch the new added lines but then its no longer support edit functionalities. Is it a limitation by Ajax or Javascript?

Prahapp avatar Aug 27 '21 11:08 Prahapp