Board Logo

How to change the tooltips for a tigra table?
nishanttheone - 11/28/2005 at 07:10 AM

We are currently doing globalization of our product , which requires us to change the tooltips of the tigra table dynamically.

Can nyone help me with it?


spw - 1/16/2006 at 04:51 AM

The only tooltips I could find in the generic product were for the sorting images in the table.css file. If you add tooltips here for different fields then i suggest building the table.css dynamically using php - had moderate success with php for other things like page counters or dynamically positioning indicators based on the page being built.

Hope that helps....


nishanttheone - 1/16/2006 at 06:06 AM

I want to modify the tooltips for sorting the columns dynamically depending upon the user's language preferences and environment settings.


spw - 1/16/2006 at 06:24 AM

Yup - Based on previous experience I think php can be used here - you should be able to pass the environment variables to the php script and then set up the tooltip text accordingly... Prerequisite is that your web server has been set up to support PHP.

As an example here is an extract of a PHP script which positions a pointer based on the "calling page" which is being built.

/* And finally add the context indicator */
$whoami=substr($pagetomake,0,4);
$top_offset=4;
switch ($whoami)
{
case "home": $top_px = 30 + $top_offset; break;
case "fenc": $top_px = 58 + $top_offset; break;
case "shel": $top_px = 86 + $top_offset; break;
case "main": $top_px = 114 + $top_offset; break;
case "crse": $top_px = 142 + $top_offset; break;
case "agis": $top_px = 170 + $top_offset; break;
case "hors": $top_px = 170 + $top_offset; break;
case "tids": $top_px = 198 + $top_offset; break;
case "cont": $top_px = 226 + $top_offset; break;
}
print "<div id='Context' style='position:absolute; width:22px; height:18px; z-index:1; left: 155px; top: ";
print $top_px;
print "px;'><img src='images/hheadx.gif' width='22' height='18'></div> </body> </html> ";

As you can see it uses the case switch function to vary the positioning based on the value of the $whoami variable which was derived from a value ($pagetomake) passed to the script when it was invoked.

Have fun.


nishanttheone - 1/16/2006 at 07:01 AM

Thanks for your reply spw.

But my problem is there is only one page.

When the user wants to see the page in French , he should be able to see the tooltip 'Sort this column' in French.

We can get the tooltips to the code-behind but how to provide it to the tigra control?


spw - 1/17/2006 at 12:24 AM

Regardless of how many pages - the issue is that you have multiple languages/regions. For the user you will only build one page.

Let me explain: The toolltips control is taken from the menu.css when your page with the table is loaded - so the trick is to build the table.css dynamically before the table page is loaded.

Set a variable to the language/region and pass that to the php script that will build the table.css and insert the appropriate tooltips - use the case switch function.
OR
build a separate table.css for each region and use the variable to set up path to the correct one - not such a great solution and is more maintenance intensive.

For the first example this is nothing more than a PHP print statement (for the stuff before the tooltips statment), a conditional print to select the tooltip text in whatever language you have selected), and a final prnt stament for the rest of the .css file.

There are many examples and tutorials on the web about how to do this.


Softcomplex: http://www.softcomplex.com/
Back to forum: http://www.softcomplex.com/forum/