Features

サーバー側読み込みの無効

サーバー側読み込みの無効

機能

ページングを使用しないMultiRow



PageSizeを10に設定したMultiRowのページング

設定

説明

このサンプルは、DisableServerReadプロパティがどのように機能するかを示します。

このプロパティをTrueに設定した場合は、すべての項目がクライアント側に転送されます。ソート、ページング、またはフィルタ処理はクライアント側で実行されます。
この場合、スクロールバーをスクロールしたときに、データをロードするために「ロード中...」のようなメッセージは表示されません。
そうでない場合、ソート、ページング、またはフィルタ処理はサーバー側で実行されます。この場合は、「ロード中...」というメッセージが表示されることもあります。

using System.Collections.Generic;
using C1.Web.Mvc;
using Microsoft.AspNetCore.Mvc;
using MultiRowExplorer.Models;
using C1.Web.Mvc.Serialization;
using Microsoft.AspNetCore.Http;

namespace MultiRowExplorer.Controllers
{
    public partial class MultiRowController : 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(IFormCollection collection)
        {
            _disableServerReadSetting.LoadPostData(collection);
            ViewBag.DemoOptions = _disableServerReadSetting;
            return View();
        }

        public ActionResult DisableServerRead_Bind([C1JsonRequest] CollectionViewRequest<Sale> requestData)
        {
            return this.C1Json(CollectionViewHelper.Read(requestData, Sale.GetData(500)));
        }

    }
}
@model IEnumerable<Sale>

@{
    ControlOptions optionsModel = ViewBag.DemoOptions;
    ViewBag.DemoSettings = true;
}

<h4>@Html.Raw(MultiRowRes.DisableServerRead_Text2)</h4>

<c1-multi-row id="dsrMultiRow" class="multirow" is-read-only="true">
    <c1-flex-grid-filter></c1-flex-grid-filter>
    <c1-items-source disable-server-read="@(Convert.ToBoolean(optionsModel.Options["Disable Server Read"].CurrentValue))"
                     initial-items-count="10"
                     read-action-url="@Url.Action("DisableServerRead_Bind")"></c1-items-source>
    <c1-multi-row-cell-group>
        <c1-multi-row-cell binding="ID"></c1-multi-row-cell>
        <c1-multi-row-cell binding="Active"></c1-multi-row-cell>
    </c1-multi-row-cell-group>
    <c1-multi-row-cell-group>
        <c1-multi-row-cell binding="Start"></c1-multi-row-cell>
        <c1-multi-row-cell binding="End"></c1-multi-row-cell>
    </c1-multi-row-cell-group>
    <c1-multi-row-cell-group colspan="2">
        <c1-multi-row-cell binding="Country" colspan="2"></c1-multi-row-cell>
        <c1-multi-row-cell binding="Product"></c1-multi-row-cell>
        <c1-multi-row-cell binding="Color"></c1-multi-row-cell>
    </c1-multi-row-cell-group>
    <c1-multi-row-cell-group colspan="2">
        <c1-multi-row-cell binding="Amount"></c1-multi-row-cell>
        <c1-multi-row-cell binding="Amount2"></c1-multi-row-cell>
        <c1-multi-row-cell binding="Discount" colspan="2"></c1-multi-row-cell>
    </c1-multi-row-cell-group>
</c1-multi-row>

<br />
<br />
<h4>@Html.Raw(MultiRowRes.DisableServerRead_Text3)</h4>

<c1-multi-row id="dsrPagingMultiRow" class="multirow" is-read-only="true">
    <c1-flex-grid-filter></c1-flex-grid-filter>
    <c1-items-source disable-server-read="@(Convert.ToBoolean(optionsModel.Options["Disable Server Read"].CurrentValue))"
                     page-size="10"
                     read-action-url="@Url.Action("DisableServerRead_Bind")"></c1-items-source>
    <c1-multi-row-cell-group>
        <c1-multi-row-cell binding="ID"></c1-multi-row-cell>
        <c1-multi-row-cell binding="Active"></c1-multi-row-cell>
    </c1-multi-row-cell-group>
    <c1-multi-row-cell-group>
        <c1-multi-row-cell binding="Start"></c1-multi-row-cell>
        <c1-multi-row-cell binding="End"></c1-multi-row-cell>
    </c1-multi-row-cell-group>
    <c1-multi-row-cell-group colspan="2">
        <c1-multi-row-cell binding="Country" colspan="2"></c1-multi-row-cell>
        <c1-multi-row-cell binding="Product"></c1-multi-row-cell>
        <c1-multi-row-cell binding="Color"></c1-multi-row-cell>
    </c1-multi-row-cell-group>
    <c1-multi-row-cell-group colspan="2">
        <c1-multi-row-cell binding="Amount"></c1-multi-row-cell>
        <c1-multi-row-cell binding="Amount2"></c1-multi-row-cell>
        <c1-multi-row-cell binding="Discount" colspan="2"></c1-multi-row-cell>
    </c1-multi-row-cell-group>
</c1-multi-row>

<c1-pager owner="dsrPagingMultiRow"></c1-pager>

@section Settings{
    @Html.Partial("_OptionsMenu", optionsModel)
}

@section Description{
<p>@Html.Raw(MultiRowRes.DisableServerRead_Text0)</p>

<p>@Html.Raw(MultiRowRes.DisableServerRead_Text1)</p>

}