Question

I use shortened enums as cell values, but I'd like to show the description for the enum in a tooltip, which uses cell's title. This is why I need to edit cell's title.

I can't find any way to access the cell's HTML-element with Slickgrid. The cells already have a title, which is it's column's title. I don't remember putting those titles there, so I guess it's some Slickgrid-stuff.

I use JQuery's tooltip-plugin for showing other tooltips.

Is there any way to edit specific cell's title?

Was it helpful?

Solution

You can get cell's HTML-element with:

grid.getCellNode(rowIndex, cellIndex)

You can then edit the title of a cell with:

grid.getCellNode(rowIndex, cellIndex).title = "foo"

If you are using jQuery you can also do:

$(grid.getCellNode(rowIndex, cellIndex)).attr("title", "foo")

If you are using SlickGrid's AutoToolTip-plugin, editing the titles of cells won't work, because the AutoToolTip-plugin overwrites the title always when hovering a cell.

OTHER TIPS

Try the following :

$("#myGrid .slick-cell").each(function(item){
    $(this).attr('title',generateTooltip($(this).text()));                 
    $(this).tooltip();
});

function generateTooltip(value){
    //return appropriate description based on the enum that is stored in 'value'
}

Hope this helps!

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top