1

I have a table field which is attached to users, before I go ahead and create the logic for adding rows on the front end via ajax, I need to know if I am going to be able to easily add the facility to delete specific rows (ideally without saving all the data again each time)?

It may well be that depending on complexity that this is more suited to a matrix field or custom database tables via a plugin.

Either way can it be done?

1 Answer 1

2

It can be done, but only by saving the table field's data completely. There's no controller method to remove a table's row(s). Same would apply for a table within a Matrix block, or for a Matrix block itself. All content gets saved by calling the entries controller (saveEntry) with the new content in a POST.

What you could do: Let your users create one or more matrix blocks, create your own plugin, create a controller with an actionDeleteMatrixBlockById() method (for instance) and let that controller call craft()->matrix->deleteBlockById() if one of the blocks has to be deleted.

Bit of a hassle, though. Don't know your use-case, but seems a bit overkill.

2
  • Is this the same with Matrix rows?? Commented Mar 23, 2015 at 20:12
  • See the edit, I added some Matrix info.
    – Paul
    Commented Mar 23, 2015 at 20:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.