Author Topic: Image in Header  (Read 288 times)

mikep

  • Pro Ultimate
  • Full Member
  • *
  • Posts: 163
    • View Profile
Image in Header
« on: August 27, 2024, 01:30:53 am »
I'm defining a column like this, to get text and image in the header, but when looking at the fields filter for this column, the entire title (to include the span html) displays.
title: "<span title = 'Desc goes here'>Column Text <img src='Images/Info.svg' /></span>",

Is there another way to add a column with text + image, so that when you view the available fields to filter, the title excludes the html? In the case above it should only display "Column Text" in the fields filter.




paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 6307
    • View Profile
Re: Image in Header
« Reply #1 on: August 29, 2024, 11:02:35 pm »
you can use menuUI option to extract text onlly from titles in menu.

Code: [Select]
        menuUI: {
            gridOptions:{
                columnTemplate: {
                    renderLabel: function(ui){
                        //debugger
                        const spanElement = document.createElement('span');
                        spanElement.innerHTML = ui.cellData
                        spanElement.innerHTML = spanElement.innerText;
                        return spanElement.innerText;                   
                    }
                }
            }
        },
« Last Edit: August 29, 2024, 11:18:26 pm by paramvir »