insert component vue in the table

insert component vue in the table

bertux77bertux77 Posts: 1Questions: 1Answers: 0

Hello, I am working with datatable and ajax and I would like to know if it is possible to insert a vue component inside a cell???? I'm trying but it doesn't show.

Any help?

Answers

  • LapointeLapointe Posts: 430Questions: 81Answers: 4

    Hi @bertux77

    What do you mind ? What kind of vue component ?

    You can use both html for cell content, using getformater in php or render on field definition

                    {
                        data: 'recettes.ID_Utilisateur',
                        className: 'dt-render',
                        render: function ( data, type, row ) {
                            return ((data) ? row.utilisateurs.Nom+' ('+'ID : '+data+')':'Global');
                        }
                    },
    
  • allanallan Posts: 61,650Questions: 1Answers: 10,094 Site admin

    As Lapointe says you can insert HTML into a cell, so you could insert a Vue component and then have Vue dynamically register it, but I would very strongly suggest against it. You need to include some extra libraries from Vue to make that possible and the file size gets large. You'll also run into issues where both DataTables and Vue are trying to control the same DOM elements, which is just tears waiting to happen!

    Allan

This discussion has been closed.