SugarCRM Developers on Twitter

HOWTO: Add a hover popup to Dashlet Listviews

All of the ListView widgets in Sugar are metadata driven, meaning that you can change the fields shown in them as well as the order and layout of the fields through the metadata files. But you can also customize the actual HTML using is displaying a field in the listview, which we’ll look at in this post.

I recently saw this forums post, which was asking how to show to additional details hover over that we show on the calendar entries on the Tasks Dashlet listview as well. To do this, we simply need to make a small alteration to the dashlet definitions for this module, which we can make in an upgrade-safe way in the custom/modules/Tasks/metadata/dashletviewdefs.php file as shown below:

What we’ve done is simply include the previous dashlet definitions ( as defined in the modules/Tasks/Dashlets/MyTasksDashlet/MyTasksDashlet.data.php file ), then made a small change to make sure they are in the array key expected ( the DashletGeneric::loadCustomMetadata() method expects to look in the <modulename>Dashlet key for definitions ). Now we added the change needed to the name field by adding the ‘custom_code’ attribute, providing the HTML needed to display the field the way we want to. The final result will look something like the below image if you hover your mouse over the name in the listview.