FlexGrid
グループパネル
機能
サンプル
設定
説明
GroupPanel 機能では、ドラッグドロップグループ化 UI を任意の FlexGrid コントロールに追加できます。
ドラッグ&ドロップ操作は、コンピュータでマウスを使用して動作し、タッチデバイス上でタッチ操作を使用して動作します。
GroupDescriptionCreator を True に設定すると、「開始」および「終了」列を年でグループ化でき、「国」列を大陸名でグループ化できます。
ShowDragGlyphsをtrueに設定すると、グループマーカーの要素にドラッググリフを表示できます。falseに設定すると、グループマーカーの要素にドラッググリフを非表示にできます。
ドラッグ&ドロップ操作は、コンピュータでマウスを使用して動作し、タッチデバイス上でタッチ操作を使用して動作します。
GroupDescriptionCreator を True に設定すると、「開始」および「終了」列を年でグループ化でき、「国」列を大陸名でグループ化できます。
ShowDragGlyphsをtrueに設定すると、グループマーカーの要素にドラッググリフを表示できます。falseに設定すると、グループマーカーの要素にドラッググリフを非表示にできます。
ソース
GroupPanelController.cs
using Microsoft.AspNetCore.Mvc;
using MvcExplorer.Models;
using System.Collections.Generic;
using C1.Web.Mvc;
using C1.Web.Mvc.Serialization;
using Microsoft.AspNetCore.Http;
namespace MvcExplorer.Controllers
{
public partial class FlexGridController : Controller
{
private readonly ControlOptions _gridGroupPanelModel = new ControlOptions
{
Options = new OptionDictionary
{
{"Max Groups", new OptionItem {Values = new List<string> {"3", "4", "5", "6"}, CurrentValue = "3"}},
{"Placeholder", new OptionItem {Values = new List<string> {Localization.FlexGridRes.GroupPanel_Placeholder1, Localization.FlexGridRes.GroupPanel_Placeholder2}, CurrentValue = Localization.FlexGridRes.GroupPanel_Placeholder1}},
{"Hide Grouped Columns", new OptionItem {Values = new List<string> {"True", "False"}, CurrentValue = "False"}},
{"Group Description Creator", new OptionItem {Values = new List<string> {"True", "False"}, CurrentValue = "False"}},
{"Show Drag Glyphs", new OptionItem {Values = new List<string> {"True", "False"}, CurrentValue = "False"}}
}
};
public ActionResult GroupPanel(IFormCollection data)
{
_gridGroupPanelModel.LoadPostData(data);
ViewBag.DemoOptions = _gridGroupPanelModel;
return View();
}
public ActionResult GroupPanel_Bind([C1JsonRequest] CollectionViewRequest<Sale> requestData)
{
return this.C1Json(CollectionViewHelper.Read(requestData, Sale.GetData(500)));
}
}
}
GroupPanel.cshtml
@model IEnumerable<Sale>
@{
ControlOptions optionsModel = ViewBag.DemoOptions;
ViewBag.DemoSettings = true;
}
<script type="text/javascript">
var europe = ["UK", "France", "German", "Italy"],
american = ["US", "Canada"], asian = ["Japan", "China", "Korea"], autralian = ["Australia"];
function customGroup(prop) {
switch (prop) {
case 'Start':
case 'End':
return new wijmo.collections.PropertyGroupDescription(prop, function (item, prop){
return wijmo.Globalize.formatDate(item[prop], 'yyyy');
});
break;
case 'Country':
return new wijmo.collections.PropertyGroupDescription(prop, function (item, prop){
if (europe.indexOf(item.Country) > -1) {
return "Europe";
}
else if (american.indexOf(item.Country) > -1) {
return "American";
}
else if (asian.indexOf(item.Country) > -1) {
return "Asian";
} else {
return "Australian";
}
});
break;
}
}
</script>
<c1-flex-grid id="ovFlexGrid" auto-generate-columns="false" is-read-only="true" class="grid">
<c1-flex-grid-column binding="ID"></c1-flex-grid-column>
<c1-flex-grid-column binding="Start"></c1-flex-grid-column>
<c1-flex-grid-column binding="End"></c1-flex-grid-column>
<c1-flex-grid-column binding="Country"></c1-flex-grid-column>
<c1-flex-grid-column binding="Product"></c1-flex-grid-column>
<c1-flex-grid-column binding="Color"></c1-flex-grid-column>
<c1-flex-grid-column binding="Active"></c1-flex-grid-column>
<c1-items-source read-action-url="@Url.Action("GroupPanel_Bind")"></c1-items-source>
<c1-flex-grid-group-panel max-groups="@(Convert.ToInt32(optionsModel.Options["Max Groups"].CurrentValue))"
placeholder="@(optionsModel.Options["Placeholder"].CurrentValue)"
hide-grouped-columns="@(Convert.ToBoolean(optionsModel.Options["Hide Grouped Columns"].CurrentValue))"
group-description-creator=@((Convert.ToBoolean(optionsModel.Options["Group Description Creator"].CurrentValue)) ? "customGroup" : "null")
show-drag-glyphs="@(Convert.ToBoolean(optionsModel.Options["Show Drag Glyphs"].CurrentValue))">
</c1-flex-grid-group-panel>
</c1-flex-grid>
@section Settings{
@await Html.PartialAsync("_OptionsMenu", optionsModel)
}
@section Description{
@Html.Raw(FlexGridRes.GroupPanel_Text0)
<br/>
@Html.Raw(FlexGridRes.GroupPanel_Text1)
<br/>
@Html.Raw(FlexGridRes.GroupDescriptionCreator_Text0)
<br/>
@Html.Raw(FlexGridRes.GroupPanel_Text2)
}
マニュアル