Bind the current row to delete cleanly

parent 15f4c7d8
...@@ -7,7 +7,8 @@ ...@@ -7,7 +7,8 @@
props: { props: {
deleteAction: {default: null}, deleteAction: {default: null},
deleteMessage: {default: "Are you sure you want to delete this record?"}, deleteMessage: {default: "Are you sure you want to delete this record?"},
deleteTitle: {default: "Confirmation"} deleteTitle: {default: "Confirmation"},
rowId: {default: null},
}, },
methods: { methods: {
deleteRow(event) { deleteRow(event) {
...@@ -24,7 +25,8 @@ ...@@ -24,7 +25,8 @@
type: 'success', type: 'success',
message: response.data.message message: response.data.message
}); });
$(event.path[3]).remove();
$('#' + $self.rowId).remove();
} }
}) })
.catch(function (error) { .catch(function (error) {
......
...@@ -38,7 +38,7 @@ ...@@ -38,7 +38,7 @@
<tbody> <tbody>
<?php if (isset($pages)): ?> <?php if (isset($pages)): ?>
<?php foreach ($pages as $page): ?> <?php foreach ($pages as $page): ?>
<tr> <tr id="table-row-{{$page->id}}">
<td> <td>
<a href="{{ URL::route('admin.page.page.edit', [$page->id]) }}"> <a href="{{ URL::route('admin.page.page.edit', [$page->id]) }}">
{{ $page->id }} {{ $page->id }}
...@@ -64,7 +64,8 @@ ...@@ -64,7 +64,8 @@
<a href="{{ URL::route('admin.page.page.edit', [$page->id]) }}" class="btn btn-default btn-flat"><i class="fa fa-pencil"></i></a> <a href="{{ URL::route('admin.page.page.edit', [$page->id]) }}" class="btn btn-default btn-flat"><i class="fa fa-pencil"></i></a>
<delete-button <delete-button
delete-action="{{ route('api.page.page.destroy', [$page->id]) }}"> delete-action="{{ route('api.page.page.destroy', [$page->id]) }}"
row-id="table-row-{{ $page->id }}">
</delete-button> </delete-button>
</div> </div>
</td> </td>
......
...@@ -69057,7 +69057,8 @@ Object.defineProperty(__webpack_exports__, "__esModule", { value: true }); ...@@ -69057,7 +69057,8 @@ Object.defineProperty(__webpack_exports__, "__esModule", { value: true });
props: { props: {
deleteAction: { default: null }, deleteAction: { default: null },
deleteMessage: { default: "Are you sure you want to delete this record?" }, deleteMessage: { default: "Are you sure you want to delete this record?" },
deleteTitle: { default: "Confirmation" } deleteTitle: { default: "Confirmation" },
rowId: { default: null }
}, },
methods: { methods: {
deleteRow: function deleteRow(event) { deleteRow: function deleteRow(event) {
...@@ -69075,7 +69076,8 @@ Object.defineProperty(__webpack_exports__, "__esModule", { value: true }); ...@@ -69075,7 +69076,8 @@ Object.defineProperty(__webpack_exports__, "__esModule", { value: true });
type: 'success', type: 'success',
message: response.data.message message: response.data.message
}); });
$(event.path[3]).remove();
$('#' + $self.rowId).remove();
} }
}).catch(function (error) { }).catch(function (error) {
$self.$message({ $self.$message({
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment