반응형
좋은 테이블에서 선택한 행의 데이터를 가져오다.
얘들아, 나 처음이라 어떻게 해야 할지 모르겠는데 여기서 현재 선택된 행의 데이터를 어떻게 얻을 수 있는지 코드야.
<div class="table-responsive-sm">
<vue-good-table
title="Page List"
:columns="columns1"
:rows="rows1"
:paginationOptions="{enabled: false}">
<template slot="table-row-after" slot-scope="props" >
<td class="fancy"><input type="checkbox" v-model="checkview[props.row.originalIndex]">
</td>
<td class="has-text-right"><input type="checkbox" v-model="checkedit[props.row.originalIndex]"></td>
<td class="has-text-right"><input type="checkbox" v-model="checkupate[props.row.originalIndex]"></td>
<td class="has-text-right"><input type="checkbox" v-model="checkdelete[props.row.originalIndex]"></td>
</template>
</vue-good-table>
columns1: [
{
label: 'Page Name',
field: 'pagename',
sortable: false,
},
{
label: 'View',
sortable: false,
},
{
label: 'edit',
sortable: false,
},
{
label: 'update',
sortable: false,
},
{
label: 'delete',
sortable: false,
},
],
rows1:[],
methods:{
getTotals1(){
var self = this;
this.$http.get('http://localhost:3000/api/permissionpgs')
.then(function (response) {
console.log(response.data)
self.rows1 = response.data;
})
},
}
저장 방법이 트리거될 때 값진 데이터를 가져올 수 있는 방법이 있는지 확인하십시오.마지막으로 이것은 좋은 테이블이다.
체크된 항목의 값을 3개의 다른 객체에 저장한다. checkedit
,checkupdate
그리고checkdelete
사용자가 테이블에서 확인란을 확인/선택 취소하는 경우이러한 물체는 다음과 같은 형태를 가질 것이다.
checkupdate{
2: true, // index of the row: whether checked or unchecked
5: false,
20: true
}
참조.URL: https://stackoverflow.com/questions/49704156/get-data-of-slected-row-in-vue-good-table
반응형
'Programing' 카테고리의 다른 글
Vuex 상태가 어레이를 개체로 반환하는 이유 (0) | 2022.04.12 |
---|---|
Vue / Typecript, got Module ''*.vue'에 내보낸 멤버가 없음 (0) | 2022.04.12 |
두 어레이를 반복하고 데이터 결합 (0) | 2022.04.11 |
모든 구성 요소에서 방법을 공유하기 위해 Vue Mixins, "확장" 또는 Vuex를 사용해야 하는가? (0) | 2022.04.11 |
npm 패키지에서 가져온 vue 구성 요소를 확장하는 방법 (0) | 2022.04.11 |