Column Sizing Events
FlexGrid raises resizingColumn and resizedColumn events as the user resizes the columns.
The example below handles the resizingColumn event to show a tooltip with the column's new width:
ID
Country
Sales
Expenses
Overdue
0
US
81,732.54
38,401.13
1
Germany
20,603.32
27,944.24
2
UK
44,217.79
48,877.49
3
Japan
29,190.63
23,365.74
4
Sweden
46,951.19
49,107.56
5
Norway
86,237.02
49,767.35
6
Denmark
31,459.18
40,845.40
ID
Country
Sales
Expenses
Overdue
0
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | // This file locates: "Scripts/Lesson/C1FlexGrid/EventsResizing.js".c1.documentReady(function () { var theGrid = wijmo.Control.getControl('#theGrid'); var tt = new wijmo.Tooltip(); theGrid.resizingColumn.addHandler(function(s, e) { var tip = wijmo.format('Column <b>{col}</b>, width <b>{wid:n0}px</b>', { col: s.columns[e.col].header, wid: s.columns[e.col].width }) tt.show(theGrid.hostElement, tip); }); theGrid.resizedColumn.addHandler(function (s, e) { tt.hide(); });}); |
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: EventsResizing public ActionResult EventsResizing() { return View(Models.FlexGridData.GetSales(Models.FlexGridData.Countries7)); } }} |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | @model IEnumerable<FlexGridData.Sale><h1> @Html.Raw(Resources.C1FlexGrid.EventsResizing_Title)</h1><p> @Html.Raw(Resources.C1FlexGrid.EventsResizing_Text1)</p><p> @Html.Raw(Resources.C1FlexGrid.EventsResizing_Text2)</p>@(Html.C1().FlexGrid().Id("theGrid") .Bind(Model) .AutoGenerateColumns(false) .Columns(cs=> { cs.Add().Binding("Id").Header("ID").Width("50").IsReadOnly(true); cs.Add().Binding("Country").Header("Country").IsRequired(true); cs.Add().Binding("Sales").Header("Sales").Format("n2"); cs.Add().Binding("Expenses").Header("Expenses").Format("n2"); cs.Add().Binding("Overdue").Header("Overdue"); }) .Height(200)) |
