cancel
Showing results for 
Search instead for 
Did you mean: 

TextView - show tooltip when text is blank

former_member182374
Active Contributor
0 Kudos

Hello Experts,

I'm using sap.ui.commons.TextView is my code.

I've noticed that when text is blank the tooltip is now shown.

var myTextView = new sap.ui.commons.TextView({
  text : "",
tooltip : "Tooltip" })

I tried to change the text to ' ', \0020, \t etc but text is still blank (I guess there is a function that clears white spaces)

So how can show tooltip when text is blank?

The TextView is a part of a table column so I don't want to use DOM manipulation in order to set the tooltip.

SAPUI5 version is 1.28.7.

Regards,

Omri

junwu
Active Contributor
0 Kudos

didn't get u.

show tooltip only when text is blank?

View Entire Topic
saivellanki
Active Contributor
0 Kudos

Hi Omri,

I tried to check what you're trying to do. Let me just confirm few things:

1. You're using sap.ui.commons.TextView basically just to display the text, which is similar to sap.m.Text from 'm' library.

2. TextView control is used in one of the column as a template having table as parent control. I am assuming that you're using sap.ui.table.Table control.

If above points are correct, then let's get into the issue - you say when the value is empty then tool-tip is not seen.

Yes, you will not be able to see the tool-tip when the value is not filled. As you predicted, there might be a condition if value is empty - do not show the tool tip.

(or) the easier way that I see this issue might have also caused due to height of textview control. When the value is not set, then the text view height is limited to 0px.

Here is a snap:

In order to get rid of the above problem, you might need to set the height of textview using CSS. Generally, the cell size is of '18px', you can set the same height to text view and check. It should work. I know this is not the usual way, but I see this is simple. Let me know your thoughts.

Here is a sample and snippet:

Sample: Table - JS Bin

Snippet:

e

Regards,