I have a Table in a custom plugin. I would like to select a row and update the values of selected row using Edit button. There is only one Edit button on the top right corner of the plugin.
1 Answer
Try to find out what values you are getting back when you click Edit in your block. I think you will get following:
- your page entity id,
- view name
- Selected Item Id.
With this information you can get the entity from Commerce engine database using find entity pipeline, you must be storing your data in some component so you can get that component from entity and find the row by Item Id.
Then create another view that will allow content authors to edit the values (this is similar to add but for Edit this time)
Then you need to add an action for update (you must be having a similar action on add)
Do following in edit action:
- get your posted values
- get your entity from commerce database
- update properties/components in your entity
- persist entity in commerce database.