FlexGrid
Column Pinning
AllowPinning property allows to add pin icons to the column headers and clicking the icons toggles the column's frozen state
Features
Sample
Settings
Description
AllowPinning property allows to add pin icons to the column headers and clicking the icons toggles the column's frozen state
Source
ColumnPinningController.cs
using MvcExplorer.Models; using System.Collections.Generic; using System.Web.Mvc; namespace MvcExplorer.Controllers { public partial class FlexGridController : Controller { private readonly ControlOptions _columnPinningDataModel = new ControlOptions { Options = new OptionDictionary { {"Pinning Type", new OptionItem {Values = new List<string> { "None", "SingleColumn", "ColumnRange", "Both"}, CurrentValue = "SingleColumn"}} } }; public ActionResult ColumnPinning(FormCollection collection) { IValueProvider data = collection; _columnPinningDataModel.LoadPostData(data); var model = Sale.GetData(500); ViewBag.DemoOptions = _columnPinningDataModel; return View(model); } } }
ColumnPinning.cshtml
@using C1.Web.Mvc.Grid @model IEnumerable<Sale> @{ ControlOptions optionsModel = ViewBag.DemoOptions; ViewBag.DemoSettings = true; } @(Html.C1().FlexGrid<Sale>() .Id("ovFlexGrid") .AutoGenerateColumns(true) .CssClass("grid") .IsReadOnly(true) .Bind(bl => bl.Bind(Model)) .PinningType((PinningType)Enum.Parse(typeof(PinningType), optionsModel.Options["Pinning Type"].CurrentValue)) .Width("900px") ) @section Settings{ @Html.Partial("_OptionsMenu", optionsModel) } @section Summary{ <p>@Html.Raw(Resources.FlexGrid.AllowPinning_Text0)</p> } @section Description{ @Html.Raw(Resources.FlexGrid.AllowPinning_Text0) }
Documentation