FlexGrid
Disable Server Reading
Features
Sample
FlexGrid without paging
Paging FlexGrid which PageSize is set to 10
Settings
Description
This sample shows what the DisableServerRead property works for.
When it is set to True, all the items will be transferred to the client side. Sorting, paging or filtering will be done in the client side.
And the text like "Loading..." is not shown for loading the data when the scrollbar scrolls.
Otherwise, sorting, paging or filtering will be done in server side. And sometimes the "Loading..." text will be shown.
Source
DisableServerReadController.cs
using MvcExplorer.Models; using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.Mvc; using C1.Web.Mvc; using System.Collections; using System.Globalization; namespace MvcExplorer.Controllers { public partial class FlexGridController : Controller { private readonly ControlOptions _disableServerReadSetting = new ControlOptions { Options = new OptionDictionary { {"Disable Server Read",new OptionItem{Values = new List<string> {"True", "False"},CurrentValue = "True"}} } }; public ActionResult DisableServerRead(FormCollection collection) { IValueProvider data = collection; if (CallbackManager.CurrentIsCallback) { var request = CallbackManager.GetCurrentCallbackData<CollectionViewRequest<object>>(); if (request != null && request.ExtraRequestData != null) { var extraData = request.ExtraRequestData.Cast<DictionaryEntry>() .ToDictionary(kvp => (string)kvp.Key, kvp => kvp.Value.ToString()); data = new DictionaryValueProvider<string>(extraData, CultureInfo.CurrentCulture); } } _disableServerReadSetting.LoadPostData(data); ViewBag.DemoOptions = _disableServerReadSetting; return View(Sale.GetData(500)); } } }
DisableServerRead.cshtml
@model IEnumerable<Sale> @{ ControlOptions optionsModel = ViewBag.DemoOptions; ViewBag.DemoSettings = true; } <h4>@Html.Raw(Resources.FlexGrid.DisableServerRead_Text1)</h4> @(Html.C1().FlexGrid<Sale>() .AutoGenerateColumns(true) .Id("dsrFlexGrid") .CssClass("grid") .IsReadOnly(true) .Filterable() .Bind(b => b.DisableServerRead(Convert.ToBoolean(optionsModel.Options["Disable Server Read"].CurrentValue)).InitialItemsCount(10).Bind(Model)) ) <br/> <br/> <h4>@Html.Raw(Resources.FlexGrid.DisableServerRead_Text2)</h4> @(Html.C1().FlexGrid<Sale>() .AutoGenerateColumns(true) .CssStyle("height", "auto") .Id("dsrPagingGrid") .CssClass("grid") .IsReadOnly(true) .Filterable() .Height(300) .Bind(b => b.DisableServerRead(Convert.ToBoolean(optionsModel.Options["Disable Server Read"].CurrentValue)).PageSize(10).Bind(Model)) ) @(Html.C1().Pager().Owner("dsrPagingGrid")) @section Settings{ @Html.Partial("_OptionsMenu", optionsModel) } @section Description{ @Html.Raw(Resources.FlexGrid.DisableServerRead_Text0) }
Documentation