Using dijit Tooltip in relationship grid – how to get connectId?

Hi, I want to add a dijit tooltip to a column in the relationship grid. The tooltip shall open, when elements of this specific column are selected. For a first test I used an onSelectRow Method in the corresponding RelationshipType. Currently I try to run the following sample: https://dojotoolkit.org/reference-guide/1.10/dijit/Tooltip.html
require(["dijit/Tooltip", "dojo/domReady!"], function(Tooltip){
    new Tooltip({
        connectId: ["exampleNode"],
        label: "the text for the tooltip"
    });
});
Right now I have some trouble to get the correct "connectId" for the tooltip element. Any ideas of how to use this parameter? I am already able to open a standard dijit dialog in a similar way. But the standard dialog is always placed in the middle of the screen and not connected to a certain cell position. Thanks for your help! Angela
  • Hi Angela, The connectId argument expects the id attribute of the HTML node you'd like to add the tooltip to. I was able to get the ID of a column header with the sample below in Google Chrome in 11.0 SP12. var columnHeaderId = document.selectSingleNode("//div[contains(@class, 'dojoxGridSortNode') and text() = 'YOUR_COLUMN_NAME']").parentNode.id; You should then be able to pass the result of this sample directly into your tooltip like below.
    require(["dijit/Tooltip", "dojo/domReady!"], function(Tooltip){
    new Tooltip({
    connectId: [columnHeaderId],
    label: "the text for the tooltip"
    });
    });
    Please note that the class names and general structure of the HTML of Aras Innovator can change between service packs, so you may need to modify this sample if you're not using 11.0 SP12. Chris
    Christopher Gillis Aras Labs Software Engineer
  • Hi Chris, thanks for the fast answer! I can confirm that your code works very well work Firefox and SP11! Using tooltips in the columns is already a good usecase. But is it also possible, to add the Tooltip to specific cells? I made a few attempts to catch certain dojoxGridCells of a specific column, but weren´t able to catch the correct structure. This is why I used the onSelectRow RelationshipType event. An "onSelectCell" event would be more suitable, but I don´t think something like this exists. As soon a users clicks an element of a specific column, a tooltip shall appear with additional specific information regarding the related Item. Angela
  • Hi Angela, You're correct that there isn't a onSelectCell event. Beyond writing a custom relationship grid, adding this code to the onSelectRow event is probably your best bet. The individual cells don't have IDs on them, but it looks like you might be able to use this code from the link you provided to attach a tooltip to all of the cells in the grid.
    require(["dijit/Tooltip", "dojo/query!css2", "dojo/domReady!"], function(Tooltip){
    new Tooltip({
    connectId: "myTable", // <-- You'll need to look up the ID of the grid
    selector: "tr", // <-- You can change this to "td" to add the tooltip to every cell instead of every row
    getContent: function(matchedNode){
    return matchedNode.getAttribute("tooltipText"); // <-- You can add logic here to lookup the appropriate information based on the selected cell
    }
    });
    });
    Could you clarify what kind of information you'd like to display from the cells? Chris
    Christopher Gillis Aras Labs Software Engineer
  • Hi Angela

    Is this tool tip on particular cell of a relationship or on the entire row ? How to get the connectId if I want to show the tool tip only to a particular cell ?