Customize tooltip for dropdown items

  • 23 March 2017
  • 3 replies
  • 17 views

Hello,

 

I have some business requirements to be able to hover over individual items in a drop down list and be able to see more useful information in the tooltip.

Currently, when you hover over items it will repeat what the item text is e.g a "Business" item would have Business in the tooltip. I would like to be able to edit the text in that tooltip and was wondering how I could.

 

Thank you


3 replies

Badge +9

Hi Tony B,

 

You can use jQuery script to edit the title of DDL items , first fetch all  dropdownlist  items  using  Css Path and then one by one edit there title to "custom title".

 

Example 

 

below "$("#00000000-0000-0000-0000-000000000000_52584f69-a79f-33a2-b544-1119be732718_droplist > div.drop-menu-m > div.drop-menu-m-c > div > ul > li");" is  Css path for ddl items , Please change it, as it will not be same for you.

 

 

<script>
$(document).ready(function () {
var ddlItems = $("#00000000-0000-0000-0000-000000000000_52584f69-a79f-33a2-b544-1119be732718_droplist > div.drop-menu-m > div.drop-menu-m-c > div > ul > li");

 

$(ddlItems).each(function (index) {
if( $(ddlItems)[index].title!=""){
$(ddlItems)[index].title = "custom title will appear here";
}
});
});
</script>

 

add this script to dataLabel Expression property, and keep Literal  property checked. After adding expression on  this datalabel select none and click on  ok of Expression popup.

 

Now in  Rules under Initialize rule add   Rule Set  the properties of control

here click on (configure)  and Set the properties for

1) Expression ( from context browser under expression  drag newly created expression   and checkbox should be check)

 2) Literal  (click on yes and checkbox should be check)

 

 

 

let me know if it helps.

Cheers !

Hello all,

 

Krans answer worked well thank you! To clarify, to edit each individual items title, will I have to call the index of each item seperately?

Badge +9

Hi TonyB,

 

There are some otherwas like jQuery attribute Selector where u can use to change values for all machiing item.

But here i feel it better to use each function to set title value.

Reply