ExtJS 4: How to Add Tooltip to Grid Header
This tutorial will walk through out how to add a tooltip to a Grid Header.
Join the DZone community and get the full member experience.
Join For Freethis tutorial will walk through out how to add a tooltip to a grid header. this feature is not natively supported by ext js 4 api. fortunately, there is a third-party plugin we can use to do it.
to get started, i created a javascript project on eclipse ide and it looks like this:
plugin code
the first thing we have to add (after ext js 4 sdk) is the plugin. to do so, i created a folder ux (for plugins) and a folder called grid (inside ux) because it is a plugin for ext 4 grid. then i created a file name headertooltip.js with the following content:
grid with header tooltip
now we need to build the application code. to test, simply create a data grid:
on line 1, we have to enable the ext.loader so ext can dynamic loading the files we need.
on lines 3-7 we declared the components we need to have loaded before loading our application. note the ext.ux.grid.headertooltip.js is included as well. this way, ext js knows it has to look for a file called headertooltip.js inside the folder ux/grid.
then on line 35 we have to include the headertooltip plugin as a plugin of the grid we want to display a header tooltip.
and finally, on line 42 we need to declared a column config called tooltip with the header tooltip we want to display.
html page
then we can create an html file we can run on a browser:
and when we execute the application, we will get the following:
and it is done!
disclaimer : i am not the author of this headertooltip plugin. so if you get any errors, please contact the author of the plugin on sencha forum: http://www.sencha.com/forum/showthread.php?132637-ext.ux.grid.headertooltip . i simply demonstrated how to use the plugin on this tutorial.
i’m using ext js 4.0.2a (open source version) on this project.
download the source code:
you can download the source code from:
my github: https://github.com/loiane/extjs4-grid-header-tooltip
happy coding!
from http://loianegroner.com/2011/10/extjs-4-how-to-add-tooltip-to-grid-header
Opinions expressed by DZone contributors are their own.
Comments