enterprise-ng icon indicating copy to clipboard operation
enterprise-ng copied to clipboard

Lookup: Missing setTooltip method in SohoLookupComponent

Open edgarinfor opened this issue 4 years ago • 6 comments
trafficstars

Describe the bug When using a customized interaction (settings.click) after assigning the value back into the field, it doesn't automatically recalculate the tooltip, which is done by default on the out-of-the-box implementation.

We found a workaround to access the method by grabbing the native "lookup" instance as shown below but, we should be able to do this by simply calling SohoLookupComponent.setTooltip();

//...
@ViewChild(SohoLookupComponent) sohoLookup: SohoLookupComponent;

//...
if (this.sohoLookup) {
  const lookup = <any>(this.sohoLookup)['lookup'];
  lookup.setTooltip();
}
// it should be as simple as: this.sohoLookup.setTooltip();

To Reproduce

  1. Using the "Lookup - Landmark Example"
  2. Change any of the values to be like "Very Long Long Long Long long Long Long Foo"
  3. Open the lookup and select the value
  4. Notice that no tooltip is added
  5. Using code similar to the above, the tooltip shows after setting the value

Expected behavior Ideally, the tooltip should be recalculated automatically every time that the lookup value changes; however, since we are using a customized dialog (similar to Landmark), we believe that simply exposing the method in the Angular component should be enough.

Version

  • ids-enterprise-ng: 10.9.0

Screenshots lookup-setTooltip

Platform

  • OS Version: Windows 10
  • Browser Name: Chrome
  • Browser Version: Latest

Team: WFM

edgarinfor avatar Oct 27 '21 20:10 edgarinfor

This is to change the tooltip? Or for dynamic tooltips each time you open it?

I believe that we made setTooltip private. But if you want a dynamic tooltip try to set the content option. I believe that should re-evaluate https://github.com/infor-design/enterprise/blob/main/src/components/tooltip/tooltip.js#L27

Another way is to use the beforeShow and use return it in the response https://github.com/infor-design/enterprise/blob/main/app/views/components/tooltip/example-ajax-tooltip.html#L18

If your certain that the setTooltip is needed we could investigate this in an example.

tmcconechy avatar Nov 01 '21 13:11 tmcconechy

It's to dynamically re-evaluate the tooltip when the lookup value changes...

The default behavior re-evaluates the tooltip when the dialog is closed: https://github.com/infor-design/enterprise/blob/96ff999869132e32902a74c7d4b7a833abd9b26e/src/components/lookup/lookup.js#L561

However, when using a customized dialog, this doesn't seem to work anymore...

Our workaround is to call the "afterClose" method in which we set the value into the field and then call "lookup.setTooltip()".

So, if you expose the "setTooltip" via the Component, I think that would be enough for us to implement a cleaner workaround.

Since we are using a custom dialog, I guess it would be hard for you to know when we close the dialog and when we set the value, unless you move the "lookup.setTooltip()" logic to happen every time that the input value changes.

edgarinfor avatar Nov 01 '21 13:11 edgarinfor

Did you try the content setting at all as it was the provided way? But i dont mind if the setTooltip works we can expose it

tmcconechy avatar Nov 01 '21 13:11 tmcconechy

The lookup tooltip is internally created by the IDS lookup component itself.

We are not using a separate Tooltip directive for it.

edgarinfor avatar Nov 01 '21 13:11 edgarinfor

Hmm ok.. Have to look at this use case then. That makes sense

tmcconechy avatar Nov 01 '21 13:11 tmcconechy

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contribution.

github-actions[bot] avatar May 06 '24 01:05 github-actions[bot]

This issue was closed because it has been inactive for 14 days since being marked as stale.

github-actions[bot] avatar May 20 '24 01:05 github-actions[bot]