Reputation: 277
I'm using iron-data-table loaded with JSON data from iron-ajax. I let the user select multiple lines and click "delete". The list is sent to the backend and is deleted from the database.
<iron-ajax url="/data/ban" last-response="{{users}}" auto></iron-ajax>
<iron-data-table selection-enabled multi-selection id="banTable"
items="[[users]]">
handleTap: function() {
var table = this.$$('#banTable');
$.ajax({
type: "POST",
url: "/ban/remove?_csrf=" + this.token,
data: JSON.stringify(table.selectedItems),
contentType: "application/json; charset=utf-8",
dataType: "json",
success: function (msg) {
if (msg) {
table.clearCache();
} else {
alert("Cannot update list !");
}
}
});
However on the front-end, the table is not updated. I tried table.clearCache but it does not help.
Any idea on how to proceed ?
Upvotes: 0
Views: 426
Reputation: 960
Add some id to your iron-ajax and in your success function call its generateRequest() function:
This.$.myAjax.generateRequest()
This will referesh users array
Upvotes: 1