문제

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?

도움이 되었습니까?

해결책

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.

다른 팁

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!

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top