[ 1 post ]

sjJNL

  • Username: sjJNL
  • Joined: Thu Jul 08, 2010 6:58 am
  • Posts: 42
  • GitHub: sjJNL
  • Gists: sjJNL
  • Offline
  • Profile

adding image with tooltip in data table column header

Post Posted: Thu Mar 22, 2012 11:37 am
+0-
I have added the image into the column header and the tooltip shows up on hover of this image.

The problem is that when this column header is sorted the tooltip disappears.

Code:
YAHOO.util.Event.addListener(window, "load", function() {
var tableAppt = function() {
        var myColumnDefs = [           
            {key:"state", label:"State", sortable:true, sortOptions:{defaultDir:YAHOO.widget.DataTable.CLASS_DESC},resizeable:true},
            {key:"status", label:"<span class='iconInfo' id='triggerttStatus'>Status</span>", sortable:true, resizeable:true},
            {key:"effectivefrom", label:"Effective Date", formatter:YAHOO.widget.DataTable.formatDate, sortable:true, resizeable:true},
            {key:"lob", label:"Line of Business", sortable:true, resizeable:true}
        ];

        var myDataSource = new YAHOO.util.DataSource(YAHOO.example.Data.appointments);
        myDataSource.responseType = YAHOO.util.DataSource.TYPE_JSARRAY;
        myDataSource.responseSchema = {
            fields: ["state","status","effectivefrom","lob"]
        };

        var myDataTable = new YAHOO.widget.DataTable("tblAppt", myColumnDefs, myDataSource);      
      myDataTable.set("MSG_SORTASC","");
      myDataTable.set("MSG_SORTDESC","");
      
      //Tooltip      
      var ttBtn = new YAHOO.widget.Tooltip("ttBtn", { context:"triggerttStatus"});
      ttBtn.setHeader("&nbsp;");
                  ttBtn.setFooter("&nbsp;");
                  ttBtn.setBody ("JIT: <span>Just In Time</span>");   
      //var showTimer,hideTimer;
      myDataTable.on('theadLabelMouseoverEvent', function (oArgs) {
            if (showTimer) {
               window.clearTimeout(showTimer);
               showTimer = 0;
            }
               showTimer = window.setTimeout(function() {                                          
                  ttBtn.show();
                  hideTimer = window.setTimeout(function() {
                     ttBtn.hide();
                  },3000);
               },300);         
         });
      myDataTable.on('theadLabelMouseoutEvent', function (oArgs) {
            if (showTimer) {
               window.clearTimeout(showTimer);
               showTimer = 0;
            }
            if (hideTimer) {
               window.clearTimeout(hideTimer);
               hideTimer = 0;
            }
            ttBtn.hide();
         });
          //End tooltip
       
        return {
            oDS: myDataSource,
            oDT: myDataTable
        };
    }();
});
  [ 1 post ]
Display posts from previous:  Sort by  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum