I'm trying to adapt the demo samples into my vue 3 composition app using <script setup>.
All is fine until I try to use a custom dialog template.
I've made my dialog template into its own component:
And I've got this in my main page:
and my script section:
but I get this error when I try to make the dialog pop up:
Uncaught TypeError: templateElement.call is not a function
<ejs-kanban ref="kanbanInstance" id="kanban" keyField="Status" :dataSource="kanbanData" :cardSettings="cardSettings" :dialogSettings="dialogSettings" > <e-columns> <e-column headerText="To Do" keyField="Open"></e-column> <e-column headerText="In Progress" keyField="InProgress" ></e-column> <e-column headerText="Testing" keyField="Testing"></e-column> <e-column headerText="Done" keyField="Close"></e-column> </e-columns> <template v-slot:dialogTemplate="{ data }"> <div> <table> <tbody> <tr> <td class="e-label">ID</td> <td> <div class="e-float-input e-control-wrapper"> <input id="Id" name="Id" type="text" class="e-field" v-model="data.Id" disabled /> </div> </td> </tr> <tr> <td class="e-label">Status</td> <td> <ejs-dropdownlist id="Status" name="Status" class="e-field" v-model="data.Status" :dataSource="dataSource1" placeholder="Status" ></ejs-dropdownlist> </td> </tr> <tr> <td class="e-label">Assignee</td> <td> <ejs-dropdownlist id="Assignee" name="Assignee" v-model="data.Assignee" class="e-field" :dataSource="dataSource2" placeholder="Assignee" ></ejs-dropdownlist> </td> </tr> <tr> <td class="e-label">Priority</td> <td> <ejs-dropdownlist type="text" name="Priority" id="Priority" v-model="data.Priority" popupHeight="300px" class="e-field" placeholder="Priority" :dataSource="dataSource3" ></ejs-dropdownlist> </td> </tr> <tr> <td class="e-label">Summary</td> <td> <div class="e-float-input e-control-wrapper"> <textarea type="text" name="Summary" id="Summary" class="e-field" v-model="data.Summary" ></textarea> </div> </td> </tr> </tbody> </table> </div> </template> </ejs-kanban> return { kanbanData: extend([], kanbanData, null, true), cardSettings: { contentField: 'Summary', headerField: 'Id', }, dialogSettings: { template: 'dialogTemplate', }, dataSource1: statusData, dataSource2: assigneeData, dataSource3: priorityData, data: {}, }; |
First thing is I use composition api with <script setup> so there was some slight adjustment,
But the real problem is that { data } is undefined for the dialogTemplate.
It works fine for cardTemplate, but I need help to correctly edit a task.
Here is my code so far. I can view all my tasks, but cannot edit one because:
Uncaught TypeError: data is undefined
You didn't replicate my error at all. You just posted your same example again. Pay attention to my code I posted which uses templates for both card and dialog. There is no issue if you only use dialogTemplate, but when you also customize the cardTemplate it somehow loses the data in the card.
For instance, with a custom cardTemplate, it loads and looks nice, but when I drag and drop the card, all of its data disappears. This is why the data fed to the dialogTemplate is undefined... because the cardTemplate is wrong somehow.
What is wrong with how I made my cardTemplate, and why is the data being lost when I perform an action on one of them?
<template v-slot:cardTemplate="{ data }"> <div class="card-template"> <div class="e-card-header"> <div class="e-card-header-caption"> <div class="e-card-header-title e-tooltip-text"> {{ data.Title }} </div> </div> </div> <div class="e-card-content e-tooltip-text"> <div class="e-text">{{ data.Summary }}</div> </div> <div class="to-do-list1"> <button class="tag834" :style="tagStyle"> <div class="tag835">tag1</div> </button> <button class="tag836"> <div class="tag837">Challenge</div> </button> <button class="tag838" :style="tag1Style"> <div class="tag839">tag2</div> </button> <button class="tag840"> <div class="tag841">Video</div> </button> </div> <div class="e-card-custom-footer"></div> </div> </template> return { isDataLoaded: false, kanbanData: extend([], kanbanData, null, true), cardSettings: { template: 'cardTemplate', headerField: 'Id', }, } |
That's what I needed, thanks.
Now I have a challenge with my dialog. It does pop up now and is populated with the data from the card, but the save button does nothing (console shows nothing at all is happening) cancel of course works, and delete gives an error:
Uncaught DOMException: Element.closest: '.' is not a valid selector
This is my current version of the page, there must be some small difference because it looks (I think) just like your example...:
<v-select id="Status" name="Status" class="e-field e-dropdownlist" v-model="data.Status" :options="[ { label: 'Canada', code: 'ca' }, { label: 'United States', code: 'us' }, ]" label="Status" ></v-select> |
<template v-slot:dialogTemplate="{ data }"> <div> <form id="KanbanEdit"> <table> <tbody> <tr> <td class="e-label">ID</td> <td> <div class="e-float-input e-control-wrapper"> <input id="id" name="id" type="text" class="e-field" v-model="data.Id" disabled /> </div> </td> </tr> <tr> <td class="e-label">Status</td> <td> <v-select id="Status" name="Status" class="e-field e-dropdownlist" v-model="data.Status" :options="[ { label: 'Canada', code: 'ca' }, { label: 'United States', code: 'us' }, ]" label="Status" ></v-select> </td> </tr> <tr> <td class="e-label">Summary</td> <td> <div class="e-float-input e-control-wrapper"> <textarea type="text" name="Summary" id="Summary" class="e-field" v-model="data.Summary" ></textarea> </div> </td> </tr> </tbody> </table> </form> </div> </template> |