i have a Component "CDataTable" which renders Columns in a for loop. inside the loop there is a template:
<template v-if="typeof col.template !== 'undefined'" #body="{data}">
<component :is="compile(col.template)" :data="data" :value="getColValue(data, col.field)" />
</template>
in the parent component "LocationList" i can define the column definitions in an array of objects in data():
columns: [
{field: 'test', header: "test", width: 12, template: `<span v-if="typeof value !== 'undefined'">{{value}} <i class="pi pi-search" @click="console.log(this)"></i></span>`}
]
i managed to get the rendering working like shown above, but now i want to call a function of the Parentcomponent "LocationList" in the click handler, obviously i have no access to the methods of "LocationList" so i thought i can emit an Event and listen to it there, but if i put "this.$emit" in the click handler, it shows an error that i $emit is undefined.
Then i put a console.log(this) there to get a clue why. The reason is "this" is the window object.
the question is: how can i call a function of the "LocationList" Component in the click handler?