Skip to content

Commit

Permalink
added 'Clear Table' button
Browse files Browse the repository at this point in the history
  • Loading branch information
St3Ko committed Feb 11, 2021
1 parent 3eae191 commit a8fe4ab
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 3 deletions.
17 changes: 15 additions & 2 deletions resources/dist/js/table_on_steroids-fieldtype.js
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
//
//
//
//

var Table = Vue.component('table-fieldtype');
/* harmony default export */ __webpack_exports__["default"] = ({
Expand Down Expand Up @@ -152,6 +153,9 @@ var Table = Vue.component('table-fieldtype');
this.data = this.value;
},
methods: {
handleClearTable: function handleClearTable() {
this.data = [];
},
handleClearInput: function handleClearInput() {
this.csv = '';
},
Expand Down Expand Up @@ -7888,10 +7892,19 @@ var render = function() {
_c(
"button",
{
staticClass: "btn btn-default mb-2",
staticClass: "btn btn-default mb-2 mr-1",
on: { click: _vm.handleClearInput }
},
[_vm._v("Clear input")]
[_vm._v("Clear Input")]
),
_vm._v(" "),
_c(
"button",
{
staticClass: "btn btn-default mb-2",
on: { click: _vm.handleClearTable }
},
[_vm._v("Clear Table")]
),
_vm._v(" "),
_vm.error
Expand Down
6 changes: 5 additions & 1 deletion resources/js/TableOnSteroids.vue
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
<label class="form-group-label mt-2 mb-1">Paste your CSV into this field:</label>
<textarea class="input-text w-full mb-2" v-model="csv" rows="4"></textarea>
<button class="btn btn-default mb-2 mr-1" @click="csvToJavascript">Process CSV Data</button>
<button class="btn btn-default mb-2" @click="handleClearInput">Clear input</button>
<button class="btn btn-default mb-2 mr-1" @click="handleClearInput">Clear Input</button>
<button class="btn btn-default mb-2" @click="handleClearTable">Clear Table</button>
<div class="text-red" v-if="error">{{ error }}</div>
</div>
</template>
Expand Down Expand Up @@ -45,6 +46,9 @@ export default {
this.data = this.value;
},
methods: {
handleClearTable() {
this.data = [];
},
handleClearInput() {
this.csv = ''
},
Expand Down

0 comments on commit a8fe4ab

Please sign in to comment.