Hover Styles
By default, grid cells have solid backgrounds. This can get in the way of styling rows using pseudo selectors such as :hover.
Hover on Cells
You can simply give a hover style to cells. Just add some CSS based on the '.wj-cell' class and ':hover' pseudo-selector:
Id
Country
Product
Active
Downloads
Sales
Expenses
Overdue
0
US
Phones
145,248
81,732.54
38,401.13
1
Germany
Computers
111,632
20,603.32
27,944.24
2
UK
Cameras
181,205
44,217.79
48,877.49
3
Japan
Stereos
54,740
29,190.63
23,365.74
4
Italy
Phones
126,531
46,951.19
49,107.56
5
Greece
Computers
6,073
86,237.02
49,767.35
Id
Country
Product
Active
Downloads
Sales
Expenses
Overdue
0
Hover on Rows
If you want to give a hover style to entire row, apply the hover pseudo-style to the '.wj-row' element instead, and extend it to the row's non-selected child cells:
Id
Country
Product
Active
Downloads
Sales
Expenses
Overdue
0
US
Phones
145,248
81,732.54
38,401.13
1
Germany
Computers
111,632
20,603.32
27,944.24
2
UK
Cameras
181,205
44,217.79
48,877.49
3
Japan
Stereos
54,740
29,190.63
23,365.74
4
Italy
Phones
126,531
46,951.19
49,107.56
5
Greece
Computers
6,073
86,237.02
49,767.35
Id
Country
Product
Active
Downloads
Sales
Expenses
Overdue
0
- C1FlexGrid/RowsStylingHover.js
- C1FlexGrid/RowsStylingHover.css
- RowsStylingHoverController.cs
- RowsStylingHover.cshtml
1 2 3 4 5 | // This file locates: "Scripts/Lesson/C1FlexGrid/RowsStylingHover.js". c1.documentReady(function () { var hoverCell = wijmo.Control.getControl( '#hoverCell' ); var hoverRow = wijmo.Control.getControl( '#hoverRow' ); }); |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | // This file locates: "Content/css/Lesson/C1FlexGrid/RowsStylingHover.css". .wj-flexgrid { height: 150px; } /* css for hovering on non-header cells */ #hoverCell .wj-cells .wj-cell:not(.wj-state-selected):not(.wj-state-multi-selected):hover { background-color:rgb(200,255,200); transition: all 0.5s; } /* css for hovering on non-header rows */ #hoverRow .wj-cells .wj-row:hover .wj-cell:not(.wj-state-selected):not(.wj-state-multi-selected) { transition: all 0.5s; background: rgb(200,255,200); } |
1 2 3 4 5 6 7 8 9 10 11 12 13 | using System.Web.Mvc; namespace LearnMvcClient.Controllers { public partial class C1FlexGridController : Controller { // GET: RowsStylingHover public ActionResult RowsStylingHover() { return View(Models.FlexGridData.GetSales()); } } } |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 | @model IEnumerable< FlexGridData.Sale > < h1 > @Html .Raw(Resources.C1FlexGrid.RowsStylingHover_Title) </ h1 > < p > @Html .Raw(Resources.C1FlexGrid.RowsStylingHover_Text1) </ p > @Html .C1().CollectionViewService().Id( "collectionView" ).Bind(Model) < h2 > @Html .Raw(Resources.C1FlexGrid.RowsStylingHover_Title1) </ h2 > < p > @Html .Raw(Resources.C1FlexGrid.RowsStylingHover_Text2) </ p > @Html .C1().FlexGrid().Id( "hoverCell" ).ItemsSourceId( "collectionView" ) < h2 > @Html .Raw(Resources.C1FlexGrid.RowsStylingHover_Title2) </ h2 > < p > @Html .Raw(Resources.C1FlexGrid.RowsStylingHover_Text3) </ p > @Html .C1().FlexGrid().Id( "hoverRow" ).ItemsSourceId( "collectionView" ) |