Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
<!doctype html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; UTF-8"/>
<link rel="stylesheet" href="css/ui-lightness/jquery-ui-1.8.23.custom.css" />
<link rel="stylesheet" href="js/slick_grid/slick.grid.css" type="text/css"/>
<script type="text/javascript" src="js/jquery-1.8.1.min.js"></script>
<script type="text/javascript" src="js/jquery-ui-1.8.23.custom.min.js"></script>
<script type="text/javascript" src="js/slick_grid/lib/jquery.event.drag-2.0.min.js"></script>
<script type="text/javascript" src="js/slick_grid/slick.core.js"></script>
<script type="text/javascript" src="js/slick_grid/slick.formatters.js"></script>
<script type="text/javascript" src="js/slick_grid/slick.grid.js"></script>
<script type="text/javascript" src="js/slick_grid/slick.dataview.js"></script>
</head>
<body>
<div id="myGrid" style="width:350px;min-height:300px; margin: 30px 0 0 30px;"></div>
<style>
.tooltip{
position: absolute;
top: 0px;
left: 0px;
z-index: 100;
border: solid 1px #AEAEAE;
padding: 4px 8px;
background: #FFF;
opacity: 1;
}
.tooltip img{
background: #FFF;
opacity: 1;
}
.slick-cell{
overflow: visible;
}
</style>
<script type="text/javascript">
var TaskNameFormatter = function (row, cell, value, columnDef, dataContext) {
value = value + "<span class='tooltip' id='tooltip"+dataContext["realId"]+"' style='display: none;'>"+value+" tooltip !</span>"
return value;
};
var dataView;
var grid;
var mydata = "[{\"id\": \"id_1\", \"realId\": \"26050\", \"label\": \"Test\" }, {\"id\": \"id_2\", \"realId\": \"26054\", \"label\": \"Test 2\"}]";
var data = jQuery.parseJSON(mydata);
var columns = [
{id: "nazev", width: 350, name: "Nazev", field: "label", formatter: TaskNameFormatter}
];
$(function () {
dataView = new Slick.Data.DataView({ inlineFilters: true });
dataView.setItems(data);
grid = new Slick.Grid("#myGrid", dataView, columns);
grid.onMouseEnter.subscribe(function(e, args) {
var cell = grid.getCellFromEvent(e)
var row = cell.row
var item = dataView.getItem(row);
$("#tooltip"+item.realId+"").stop().show('fast');
});
grid.onMouseLeave.subscribe(function(e, args) {
var cell = grid.getCellFromEvent(e)
var row = cell.row
var item = dataView.getItem(row);
$("#tooltip"+item.realId+"").stop().hide('fast');
});
})
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment