I would like to create a pdf of multiple selected rows within vue-tables-2. I have found a pdf library called pdfmake which looks great. Being new to this, I am struggling to see how I can:
- bring this into a vue-tables-2 component. Do I import this in the component?
- how would I create a pdf of multiple selected table row data? I have
this.checkedRowsfor the tableData content. How do I get this into the pdf?
I see how pdfmake has instructions to build out datatable content, but how can I make this work with vue-tables-2? pdfmake table content screenshot
If anyone knows a better pdf library for vue-tables-2 please let me know. Here is my code so far...
<v-server-table url="/removals" :data="tableData" :columns="columns" :options="options">
<input slot="selected" slot-scope="props" type="checkbox" :checked="props.row.selected" v-model="checkedRows" :value="props.row">
<button slot="afterFilter" type="submit" @click="createPDF">Create PDF</button>
</v-server-table>
My data content is just a very simple prototype right now:
data() {
return {
tableData: [],
checkedRows: [],
columns: [
'selected',
'sku',
],
options: {
}
}
And my method...
methods: {
createPDF() {
pdfMake.createPdf(docDefinition).download('PO.pdf');
}
}