I'm trying to get a modal to pop up on cellClick. I'm not getting any errors, but it's not working. The table still loads and my other functions run on cellClick, but not the modal. I'm using Vue, Tabulator, bootstrap.
var Tabulator = require('tabulator-tables')
export default {
name: 'Test',
data: function () {
return {
modalShow: false,
tabulator: null, // variable to hold your table
tableData: [
{name: 'Billy Bob', age: '12'},
{name: 'Mary May', age: '1'}
] // data for table to display
}
},
watch: {
// update table if data changes
tableData: {
handler: function (newData) {
this.tabulator.replaceData(newData)
},
deep: true
}
},
created: function () {
console.log('Test', this.$refs)
},
mounted () {
// instantiate Tabulator when element is mounted
this.tabulator = new Tabulator(this.$refs.table, {
data: this.tableData, // link data to table
layout: 'fitColumns',
columns: [
{title: 'Name', field: 'name', sorter: 'string', width: 200},
{title: 'Age', field: 'age', sorter: 'number', align: 'right', formatter: 'progress'}
],
cellClick: function (e, cell) {
var name = cell.getRow().getCell('name').getValue()
var value = cell.getValue()
var field = cell.getField()
console.log(name, value, field)
return {
modalShow: true
}
}
})
}
}
Test
JavaScript questions and answers, JavaScript questions pdf, JavaScript question bank, JavaScript questions and answers pdf, mcq on JavaScript pdf, JavaScript questions and solutions, JavaScript mcq Test , Interview JavaScript questions, JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)