Author Topic: multiline text in cell showing <br> on cell hover  (Read 2395 times)

logibricks

  • Pro Ultimate
  • Newbie
  • *
  • Posts: 12
    • View Profile
multiline text in cell showing <br> on cell hover
« on: November 19, 2018, 06:08:48 pm »
multiline text in cell showing <br> on cell hover mode. We have used render function for hovering on cell text.

Thanks
Aditya

paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 6309
    • View Profile
Re: multiline text in cell showing <br> on cell hover
« Reply #1 on: November 19, 2018, 09:28:16 pm »
Aditya

Please share your implementation code so that it can be checked.

logibricks

  • Pro Ultimate
  • Newbie
  • *
  • Posts: 12
    • View Profile
Re: multiline text in cell showing <br> on cell hover
« Reply #2 on: November 21, 2018, 12:17:03 pm »
render: function(ui) {
                        if (!ui.other) {
                            if(ui.rowData[ui.dataIndx] != undefined){
                            return '<span title=\'' + ui.rowData[ui.dataIndx] + '\'>' + ui.rowData[ui.dataIndx] + '</span>';
                            }
                        }
                    }

paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 6309
    • View Profile
Re: multiline text in cell showing <br> on cell hover
« Reply #3 on: November 21, 2018, 04:58:33 pm »
Please update your render function to

Code: [Select]
render: function(ui) {
     if (!ui.other) {
           if(ui.cellData != undefined){
              return '<span title=\'' + ui.cellData.replace("\n","&#013;") + '\'>' + ui.cellData + '</span>';
           }
     }
}

As this question is not directly related to grid, but to HTML title attribute in general, please refer these links for more info:

https://stackoverflow.com/questions/18606877/how-can-i-new-newline-in-title-attribute-in-html/18612227

https://stackoverflow.com/questions/358874/how-can-i-use-a-carriage-return-in-a-html-tooltip
« Last Edit: November 21, 2018, 05:04:36 pm by paramquery »

logibricks

  • Pro Ultimate
  • Newbie
  • *
  • Posts: 12
    • View Profile
Re: multiline text in cell showing <br> on cell hover
« Reply #4 on: November 22, 2018, 04:16:02 pm »
 render: function(ui) {
                            if (!ui.other) {
                                if(ui.cellData != undefined){
                                        return '<span title=\'' + ui.cellData.replace(/\n/g,"&#013;") + '\'>' + ui.cellData + '</span>';
                                }
                            }
                        }

There is a slight change in the code provided by you. And it is Working fine.