function sqGridTooltip(grid, rowIndex, colIndex, row, params) {

    var cellText = "";
    if ("text" in params) {
        cellText = params["text"];
    }

    var tooltipText = "";
    if ("tooltip" in params) {
        tooltipText = params["tooltip"];
    }

    IncrementalDOM.elementOpenStart('div');
    var elementClass = "grid-widget-tooltip";
    if ("class" in params) {
         elementClass += " "+params["class"];
    }

    IncrementalDOM.attr("class", elementClass);
    IncrementalDOM.attr("onmouseover", function (e) {
        if (e.target.classList.contains('sq-grid-icon')) {
            grid.popupElement.innerHTML = tooltipText;
            grid.popupElement.style.display = 'block';
            var viewportOffset = e.target.getBoundingClientRect();
            var viewportOffsetPopup = grid.popupElement.getBoundingClientRect();
            var top = viewportOffset.top;
            var left = viewportOffset.left;
            var height = viewportOffsetPopup.height;
            grid.popupElement.style.top = (top - height + 16) + 'px';
            grid.popupElement.style.left = (left + 20) + 'px';
            e.target.onmouseout = function () {
                grid.popupElement.style.display = 'none';
            };
        }
    });
    IncrementalDOM.elementOpenEnd('div');
    if (tooltipText) {
        IncrementalDOM.elementOpen('div', null, null, "class", "sq-grid-icon sq-grid-icon-right");
        IncrementalDOM.elementClose('div');
        IncrementalDOM.text(cellText);
    } else {
        IncrementalDOM.text(cellText);
    }

    IncrementalDOM.elementClose('div');
}