Link in Datatable Column


Topic: Link in Datatable Column

falkonde asked 5 years ago

In my datatable I have a link in one of the columns and I would like this target link to be loaded in the router-view and not load the entire application again. Or in other words if the link could be a router link and not a standard link. Is this possible?

rows: [
          {
            name: 'Tiger Nixon',
            categories: 'Lorem',
            date: '2010/04/25',
            link: '<a href="/my_url_in_app" >Text link</a>'
          },

that will work as if the code were like this:

rows: [
          {
            name: 'Tiger Nixon',
            categories: 'Lorem',
            date: '2010/04/25',
            link: '<router-link to="/my_url_in_app" >Text link </router-link>'
          },

....


Magdalena Dembna staff premium answered 5 years ago

Content from link is rendered via v-html which accepts only raw html and that's why this approach won't work. Unfortunately I don't see any solution which would make it work for datatable component. More complicated structure and nesting components within cells would require building your own table from scratch - our goal was to enable using simple html content such as links and images. Kind regards, Magdalena


Please insert min. 20 characters.

FREE CONSULTATION

Hire our experts to build a dedicated project. We'll analyze your business requirements, for free.

Status

Answered

Specification of the issue
  • User: Free
  • Premium support: No
  • Technology: MDB Vue
  • MDB Version: 5.6.0
  • Device: PC
  • Browser: Chrome
  • OS: Windows
  • Provided sample code: No
  • Provided link: No