vue.jsgridjs

How to import grid.js html function for using formatter in Vue


I am using the gridjs-vue wrapper to use grid.js with Vue. I'd like to use the formatter feature of gridjs, but it requires the html function. How do I import the html function into my component? If I try to import it from gridjs-vue, it says that html is not found in gridjs-vue.


Solution

  • Use this.$gridjs.html(...). Example:

    this.cols = [
      {
        name: 'Model',
        formatter: cell => this.$gridjs.html(`<b>${cell}</b>`)
      },
      { ... },
      { ... }
    ]
    

    See https://github.com/grid-js/gridjs-vue#gridjshtml