Hello!
I’m working on this and succeeded to save the form in a DB. Back in the panel, I want to show the database as a table. But what I also need, is a more “detailed” view on the item content (it’s too much for one table row) and “archive” the entry by changing a bool in the database. So I wanted to extend the basic dialog field and call it with either the id or with the entire data to show in the dialog.
I have problems in extending and opening the dialog. This is what I got so far (Plugin), but I get the error Cannot read property 'open' of undefined
or dialogorder is not defined
, depending on if I remove the $refs. What do I miss to extend the dialog field to dialogorder, what is the $refs thing (Just curious) and how do I get the id/content to the dialog, so I can add a method to archive it there?
partial index.php
'fields' => [ 'dialogorder' => [ 'extends' => 'dialog' ], 'orderview' => [ 'props' => [ 'data' => function () { return Db::select('xxxxx'); } ] ] ],
Entire index.js
panel.plugin('webdev/orderonline', { fields: { dialogorder: { template: ` <k-text> test </k-text> ` }, orderview: { props: { data: Array }, template: ` <table class="table table-striped"> <thead> <tr> <th>#</th> <th>Vorname</th> <th>Name</th> <th>Geburtstag</th> <th>E-Mail</th> <th>Telefon</th> </tr> </thead> <tbody> <tr v-for="item in data.data"> <td>{{item.id}}</td> <td>{{item.vorname}}</td> <td>{{item.name}}</td> <td>{{item.geburtstag}}</td> <td>{{item.mail}}</td> <td>{{item.tel}}</td> <td> <k-button @click="$refs.dialogorder.open()">HERE</k-button> </td> </tr> </tbody> </table> ` } } });