10463 : tooltips in Gantt_ASP

Question

How would I add tooltips to time items and grid cells in the Gantt_ASP

Answer

In IE-html the title attribute of a tag is interperted as a tooltip so to add the tooltip to a grid cell you only change the text in it from “Hello” to “<span title=\”The hello tooltip\”>Hello</span>”…

And for a time item you would go like this:


    private void Gantt_ASP1_OnAreaAttributes(PlexityHide.GTP.WEB.Gantt_ASP aGantt, PlexityHide.GTP.WEB.AreaAttributeEventArgs e)
    {
      if (e.AreaKind==PlexityHide.GTP.WEB.AreaKind.TimeItem)
      {        
        e.Result=" Title=\"Tooltip for this time item\"  ";
      }

    }
In Ajax things has changed slightly:

This design is a bit more complex but a lot more flexible.< ?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

 

To get a very simple tooltip you can set the title property of an img element; but our problem was: How do we let the developer do this when the img is created in javascript at the client, but the text for the tooltip is most likely prepared at the server?

 

This is how we solved it:

We added a property that lets you inject javascript code into the code we generate:

1.       Gantt_ASP.ClientSideJavaScript_TimeItemInit

And we added an event that enables you to produce a string server side that will travel down to the client and can be used in the code you injected by using the property above

2.       Gantt_ASP1.OnTimeItemUserStringPrepare

 

So if you implement just like this:

  Gantt_ASP.ClientSideJavaScript_TimeItemInit = "aImgElement.title=aClientTimeItem.UserString;\r\n";

 

  void Gantt_ASP1_OnTimeItemUserStringPrepare(PlexityHide.GTP.WEB.Gantt_ASP aGantt, PlexityHide.GTP.WEB.TimeItemUserStringPrepareArgs e)

  {

    e.result="This time item starts st "+e.ti.Start.ToLongDateString();

  }

 

You get the simple tooltip on client side movable time items, and they work both in FireFox and IE

 

Leave a Reply