I have a grid populated with data and
i want to show only 3 or 2 columns and hide rest of columns cause the grid goes very wide.
when the mouse is hovered over a row i want to show all the columns of that row as as popup /tooltip form.
Please help me with this. I searched a lot and only found out Editable popup and with button click not with hover.
function PopulateGrid() {
$("#recentNews").kendoGrid({
columns: [
{ field: 'Date', title: 'Date', width: 80,
template: '#=kendo.toString(toDate(NewsDate), "yyyy/MMM/dd") #'
},
{ field: 'TradeTime', title: 'Time', width: 60,
template: '#=kendo.toString(toDate(NewsTime), "hh:mm:ss") #'
},
{ field: 'Title', title: 'Description', width: 200 },
{ field: 'Country', title: 'Country', width: 40 },
{ field: 'Economy', title: 'Economoy', width: 40 }
],
dataSource: {
transport: {
read: {
url: 'Home/GetNews',
dataType: "json",
type: "POST"
}
},
schema: {
data: function (data) {
return data.data;
},
total: function (data) {
return data.total;
}
},
pageSize: 100
},
// change: onChange,
// dataBound: onDataBound,
dataBound: HoverOnGrid,
pageable: true,
sortable: true,
scrollable: true,
height: 565,
width: 2000
});
}
There are two separate questions about what you are trying to implement:
Gridrows (easy).Since it seems that you have already defined a function called
HoverOnGridlets write it as:where
gridis:Now, the tricky question, how to show a tooltip / popup… There is no predefined way of doing it, you should do it by yourself. The closes that you can get is defining
HoverOnGridas:and the
Gridinitialization say:But this opens a
popupbut with fields on edit mode (something that you can hack defining in thedataSource.schema.modelthat all fields are not editable:But it still shows
updateandcancelbuttons in thepopup.So, my recommendation is writing a piece of code that creates that
tooltip.EDIT: For hiding the
tooltipyou should first intercept themouseoutevent:where
hideTooltipmight be something as simple as:assuming that you are always using the same
idfor thetooltip(in this example,tooltip_window_id).