Answers.Body: <p>Because the table saves the inputs as JSON they are not individually deleted from the backend.</p>
  
  <p>The way the table works is, when you click a delete button javascript removes those inputs for each cell from the form. When the user saves the form it saves the updated cells as JSON, if there are any.</p>
  
  <p>However if you are saving each row individually then I would listen for the click of the delete button. When clicked, grab your id, then call your plugin action method for delete by using this:</p>
  
  <pre><code>Craft.postActionRequest('pluginname/controller/deleteMethod', {params:value}, function(data){ 
     "do stuff if needed…"; 
  });
  </code></pre>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-10-27T15:37:51.893Z
Answers.Text: I did not think of mass removal. Definitely it's doable. But how would I know which fields have actually been removed? Other is, I remove all data first and then update with specified fields.
Answers.UserDisplayName: Volatil3
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-10-27T15:46:31.160Z
Answers.Text: The inputs are saved in an array format, `fields[theTable][1][col2]`. You are just converting the array into JSON and saving the JSON string to the database.  So if a row is absent it doesn't show up in the JSON string. This way you don't have to worry about a specific row being deleted.
Answers.UserDisplayName: a-am
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-10-27T15:49:23.567Z
Answers.Text: I am actually using PHP's typical `POST` and reading `$_POST` variable. My question is, if a row is removed from `front`, I need to remove that record from backend Db too. How'd I know those deleted rows?
Answers.UserDisplayName: Volatil3
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-10-27T15:53:38.820Z
Answers.Text: As you populate the table you could assign the id via a data attribute.  `data-row-id="primarykey"`. Then as you listen for delete button grab that data attribute variable and pass it via the `Craft.postActionRequest ` to your controller.
Answers.UserDisplayName: a-am
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-10-27T16:18:43.500Z
Answers.Text: >data-row-id="primarykey".
  
  I am not finding the way to do it otherwise would have done it earlier :/
Answers.UserDisplayName: Volatil3
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-10-27T16:23:42.177Z
Answers.Text: How are you outputting the table input with the its data?
Answers.UserDisplayName: a-am
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-10-27T16:25:47.677Z
Answers.Text: Question is updated.
Answers.UserDisplayName: Volatil3
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-10-27T16:36:22.913Z
Answers.Text: Let us [continue this discussion in chat](http://chat.stackexchange.com/rooms/30785/discussion-between-aran-and-volatil3).
Answers.UserDisplayName: a-am
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-10-27T14:36:34.917Z
Answers.LastActivityDate: 2015-10-27T14:36:34.917Z
Answers.UserDisplayName: a-am
Body: <p>As title says, I have a URL which I need to call when someone clicks on <code>delete</code> button. I already have a primary key which I need to set and append in delete URL. How'd I do that?</p>
  
  <p><a href="https://i.sstatic.net/AXs5y.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/AXs5y.png" alt="enter image description here"></a></p>
  
  <p><em>Update</em></p>
  
  <p>Rows are being generated as:</p>
  
  <pre><code>{% if posts is defined %}
      {% for post in posts %}
          {% set rows = rows|merge([
          [
              post['scheduledTime'],
              post['URL']
          ]
          ])
      %}
          {% set index = index+1 %}
      {% endfor %}
  {% endif %}
  </code></pre>
  
Tags: <plugin-development><control-panel><custom-fieldtype>
Title: How to set url of delete button of editableTableField?
ThreadText: # How to set url of delete button of editableTableField?
  
  (Asked by: username_0 on 2015-10-27)
  
  As title says, I have a URL which I need to call when someone clicks on `delete` button. I already have a primary key which I need to set and append in delete URL. How'd I do that?
  
  [![enter image description here](https://i.sstatic.net/AXs5y.png)](https://i.sstatic.net/AXs5y.png)
  
  *Update*
  
  Rows are being generated as:
  
  ```
  {% if posts is defined %}
      {% for post in posts %}
          {% set rows = rows|merge([
          [
              post['scheduledTime'],
              post['URL']
          ]
          ])
      %}
          {% set index = index+1 %}
      {% endfor %}
  {% endif %}
  
  ```
  
  **Tags:** plugin-development, control-panel, custom-fieldtype
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2015-10-27. Score: 2
  
  Because the table saves the inputs as JSON they are not individually deleted from the backend.
  
  The way the table works is, when you click a delete button javascript removes those inputs for each cell from the form. When the user saves the form it saves the updated cells as JSON, if there are any.
  
  However if you are saving each row individually then I would listen for the click of the delete button. When clicked, grab your id, then call your plugin action method for delete by using this:
  
  ```
  Craft.postActionRequest('pluginname/controller/deleteMethod', {params:value}, function(data){ 
     "do stuff if needed…"; 
  });
  
  ```
  
  > **Comments:**
  > **username_0**: I did not think of mass removal. Definitely it's doable. But how would I know which fields have actually been removed? Other is, I remove all data first and then update with specified fields.  
  > **username_1**: The inputs are saved in an array format, `fields[theTable][1][col2]`. You are just converting the array into JSON and saving the JSON string to the database.  So if a row is absent it doesn't show up in the JSON string. This way you don't have to worry about a specific row being deleted.  
  > **username_0**: I am actually using PHP's typical `POST` and reading `$_POST` variable. My question is, if a row is removed from `front`, I need to remove that record from backend Db too. How'd I know those deleted rows?  
  > **username_1**: As you populate the table you could assign the id via a data attribute.  `data-row-id="primarykey"`. Then as you listen for delete button grab that data attribute variable and pass it via the `Craft.postActionRequest ` to your controller.  
  > **username_0**: >data-row-id="primarykey".  I am not finding the way to do it otherwise would have done it earlier :/  
  > **username_1**: How are you outputting the table input with the its data?  
  > **username_0**: Question is updated.  
  > **username_1**: Let us [continue this discussion in chat](http://chat.stackexchange.com/rooms/30785/discussion-between-aran-and-username_0).  
  
  ---
  
  