- Finished Booking an Event
- Starting UsersList (creating CGridTableRec component to view and edit a db table)
This commit is contained in:
67
src/components/CGridTableRec/CGridTableRec.ts
Normal file
67
src/components/CGridTableRec/CGridTableRec.ts
Normal file
@@ -0,0 +1,67 @@
|
||||
import Vue from 'vue'
|
||||
import { Component, Prop } from 'vue-property-decorator'
|
||||
|
||||
import { UserStore } from '../../store/Modules/index'
|
||||
import { tools } from '../../store/Modules/tools'
|
||||
|
||||
import { shared_consts } from '../../common/shared_vuejs'
|
||||
import { ICategory } from '../../model'
|
||||
|
||||
@Component({
|
||||
|
||||
})
|
||||
export default class CGridTableRec extends Vue {
|
||||
@Prop({required: true}) public mytitle: string
|
||||
@Prop({required: true}) public mylist: any[]
|
||||
@Prop({required: true}) public mycolumns: any[]
|
||||
@Prop({required: true}) public colkey: string
|
||||
public $q
|
||||
public $t
|
||||
public loading: boolean = false
|
||||
public paginationControl: {
|
||||
page: number,
|
||||
rowsPerPage: number // specifying this determines pagination is server-side
|
||||
} = { page: 1, rowsPerPage: 10 }
|
||||
|
||||
public serverData: any [] = []
|
||||
|
||||
public idsel: string = ''
|
||||
public colsel: string = ''
|
||||
|
||||
public separator: 'horizontal'
|
||||
public filter: string = ''
|
||||
public selected: any[] = []
|
||||
public dark: boolean = true
|
||||
|
||||
get tableClass() {
|
||||
if (this.dark) {
|
||||
return 'bg-black'
|
||||
}
|
||||
}
|
||||
|
||||
public selItem(item, colsel) {
|
||||
console.log('item', item)
|
||||
this.idsel = item._id
|
||||
this.colsel = colsel
|
||||
console.log('this.idsel', this.idsel)
|
||||
}
|
||||
|
||||
public SaveValue(newVal, valinitial) {
|
||||
console.log('SaveValue', newVal, 'selected', this.selected)
|
||||
|
||||
const mydata = {}
|
||||
|
||||
mydata[this.colsel] = newVal
|
||||
mydata[this.colkey] = this.idsel
|
||||
|
||||
console.log('this.idsel', this.idsel, 'this.colsel', this.colsel)
|
||||
console.table(mydata)
|
||||
|
||||
this.$emit('save', mydata)
|
||||
}
|
||||
|
||||
public created() {
|
||||
|
||||
this.serverData = this.mylist.slice() // [{ chiave: 'chiave1', valore: 'valore 1' }]
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user