New Line in Cell Comments in jQuery Spreadsheet Widget

2 Answers 68 Views
Spreadsheet
Lieven
Top achievements
Rank 1
Iron
Lieven asked on 06 Oct 2023, 01:33 PM | edited on 06 Oct 2023, 01:33 PM

Hi,

In the jQuery Spreadsheet Widget, it is possible to add a comment to a cell. When the comment contains a newline character '\n', then the comment tooltip of the spreadsheet does not show the newline. 

How can we allow newlines in a comment tooltip of a Spreadsheet Cell?

( I think that the js kendo version 2022 contained that functionality)

 

Kind regards!

 

 

2 Answers, 1 is accepted

Sort by
0
Martin
Telerik team
answered on 11 Oct 2023, 10:47 AM

Hello, Lieven,

Currently the cell.comment option accepts only string values so there is no way to display a new line through the built-in configuration.

A possible approach would be to use a separate Kendo Tooltip component, but you will need additional checks to display the Tooltip for a specific cell. Here is a small example for reference.

Let me know if you have any questions on the topic.

Regards,
Martin
Progress Telerik

Stay tuned by visiting our public roadmap and feedback portal pages! Or perhaps, if you are new to our Kendo family, check out our getting started resources
0
Lieven
Top achievements
Rank 1
Iron
answered on 02 Jan 2024, 10:01 AM

Hello Martin,

Thanks for your answer. I remember that in earlier Kendo JQuery versions, the newline was possible.

How would you implement in your proposed approach that the content of the Kendo Tooltip is equal to the comment value of the Excel cell?

Kind regards

Martin
Telerik team
commented on 05 Jan 2024, 08:45 AM

Hello, Lieven,

If you wish to display the content of the cell in the Tooltip, you can use the code snippet below:

$("#spreadSheetMain").kendoTooltip({
          filter: ".k-spreadsheet-cell",
          position: "right",
          content: function (e) { 
            //var html = "<p>Some content</p>\n\New Line";
            return e.target.children().text();
          }
        }).data("kendoTooltip");

Lieven
Top achievements
Rank 1
Iron
commented on 22 Mar 2024, 08:23 AM

Hi Martin,

Thanks for your answer. 

I need to show only the comment text in the tooltip, with the ability of new lines. 

Therefore, I have updated the filter property of the 'kendoTooltip' equal to the class .k-spreadsheet-has-comment. 

In this way, the tooltip only shows when a comment of the Excel cell exists.

But my problem is that I cannot get the comment text of that cell. 

Furthermore, I need to hide the default comment popup of the Kendo Spreadsheet.

Can you assist me with that?

$("#spreadSheetMain").kendoTooltip({ filter: ".k-spreadsheet-has-comment", position: "right", content: function (e) { //var html = "<p>Some content</p>\n\New Line"; 

return e.target.children().text();

// I need the comment of the e.target cell } }).data("kendoTooltip");

Martin
Telerik team
commented on 26 Mar 2024, 09:37 AM

Hello, Lieven,

You can hide the default comment popup using the styles below. Regarding the cell text, you can get it using the text method, and append it to the html string which is used to display a new line. Here is a small example for reference where the Tooltip appears for the ID column header. Let me know if that works for you.

<style>
          .k-tooltip.k-spreadsheet-cell-comment {
            display: none !important;
          }
  </style>

Tags
Spreadsheet
Asked by
Lieven
Top achievements
Rank 1
Iron
Answers by
Martin
Telerik team
Lieven
Top achievements
Rank 1
Iron
Share this question
or