cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
1597
Views
0
Helpful
7
Replies

Need to customize default link tooltip

aaikepae
Cisco Employee
Cisco Employee

Hi,

I want to display customize tooltip on link.

I followed the same code as posted on http://xq.cisco.com/next/NeXtSite/demos.html#Tooltip/link

However, it is not working in my case.

Below is code snipped:

nx.define('MyLinkTooltip', nx.ui.Component, {

                properties: {

                                link: {},

                                topology: {}

                },

                view: {

                                content: [{

                                                tag: 'p',

                                                content: [{

                                                                tag: 'label',

                                                                content: 'Source:'

                                                }, {

                                                                tag: 'span',

                                                                content: '{#link.model.source}'

                                                }]

                                }, {

                                                tag: 'p',

                                                content: [{

                                                                tag: 'label',

                                                                content: 'Target:'

                                                }, {

                                                                tag: 'span',

                                                                content: '{#link.model.target}'

                                                }]

                                }, {

                                                tag: 'p',

                                                content: [{

                                                                tag: 'label',

                                                                content: 'Status:'

                                                }, {

                                                                tag: 'span',

                                                                content: '{#link.model.status}'

                                                }]

                                }]

                }

});

In porps parameter put the following code:

tooltipManagerConfig: {

                nodeTooltipContentClass: 'MyNodeTooltip',

                linkTooltipContentClass: 'MyLinkTooltip'

}

Please do let me know,where I want to do the changes to implement the link tooltip.

Regards,

Sachin Samel

7 Replies 7

aaikepae
Cisco Employee
Cisco Employee

This two syntax cause error.

content: '{#link.model.source}'

Change to :

content: '{#link.model.source.id}'

Same as target

content: '{#link.model.target}'

chang to:

content: '{#link.model.target.id}'

Yes Abu. That solved my problem.

Another thing I noticed that, for boolean value false, it is not showing me any data. Can we handle it in a function which will return boolean values in string format?

e.g. content: function(){

                         //code to convert boolean to string format.

                         return str;

                         }

I tried like above code, but it was showing me the entire function definition in the popover.

Thanks,

Sachin

you can use converter to process data.

define a converter

var myConverter = {

          convert: function(value) {

               return value ? 'true' : 'false'

          },

          convertBack: function(value) {

               return value == 'true';

          }

}

and use it

content: '{#link.model.status,converter=myConverter}'

Thanks Abu.

Can you please explain what convertBack function does?

Regards,

Sachin

Hi Abu,

I tried the converter function but it is not working.

It is not returning me any value if the value is false.

I tried to debug the converter function calling by putting console.log(value), but nothing is displayed in console.

Regards,

Sachin

Hi Sachin,

this is  converter's syntax : 'key:{model,converter=converterName}'  , so if you can paste you code here, i can help on debug

Hi Sachin,

We use two-way binding for View and Model, so 'convert' mean from Model-> View and 'convertBack' means from View -> Model

Getting Started

Find answers to your questions by entering keywords or phrases in the Search bar above. New here? Use these resources to familiarize yourself with the community: