Blazor Grid 行の追加
Blazor Grid の Ignite UI for Blazor 行追加機能を使用すると、ユーザーは別のフォームやページに移動することなく、新しいデータ レコードを入力して送信できます。IgbGrid
を使用すると、ユーザーはインライン行追加と CRUD 操作用の強力な API を通じてデータを操作できます。
グリッドのテンプレートで編集操作が有効になっている IgbActionStrip
コンポーネントを追加します。その後、行にカーソルを置き、提供されたボタンを使用します。最後に ALT + + を押して、行追加 UI を表示します。
すぐに使用できる機能のフルセット は、ページング、ソート、フィルタリング、編集、グループ化から行と列の仮想化まで、あらゆる機能をカバーします。.NET 開発者には制限はありません。
Blazor Grid 行の追加の例
EXAMPLE
DATA
MODULES
RAZOR
CSS
using System;
using System.Collections.Generic;
public class NwindDataItem
{
public double ProductID { get ; set ; }
public string ProductName { get ; set ; }
public double SupplierID { get ; set ; }
public double CategoryID { get ; set ; }
public string QuantityPerUnit { get ; set ; }
public double UnitPrice { get ; set ; }
public double UnitsInStock { get ; set ; }
public double UnitsOnOrder { get ; set ; }
public double ReorderLevel { get ; set ; }
public bool Discontinued { get ; set ; }
public string OrderDate { get ; set ; }
public double Rating { get ; set ; }
public List<NwindDataItem_LocationsItem> Locations { get ; set ; }
}
public class NwindDataItem_LocationsItem
{
public string Shop { get ; set ; }
public string LastInventory { get ; set ; }
}
public class NwindData
: List <NwindDataItem >
{
public NwindData ( )
{
this .Add(new NwindDataItem()
{
ProductID = 1 ,
ProductName = @"Chai" ,
SupplierID = 1 ,
CategoryID = 1 ,
QuantityPerUnit = @"10 boxes x 20 bags" ,
UnitPrice = 18 ,
UnitsInStock = 39 ,
UnitsOnOrder = 30 ,
ReorderLevel = 10 ,
Discontinued = false ,
OrderDate = @"2012-02-12" ,
Rating = 5 ,
Locations = new List<NwindDataItem_LocationsItem>()
{
new NwindDataItem_LocationsItem()
{
Shop = @"Fun-Tasty Co." ,
LastInventory = @"2018-06-12"
},
new NwindDataItem_LocationsItem()
{
Shop = @"Farmer Market" ,
LastInventory = @"2018-04-04"
}}
});
this .Add(new NwindDataItem()
{
ProductID = 2 ,
ProductName = @"Chang" ,
SupplierID = 1 ,
CategoryID = 1 ,
QuantityPerUnit = @"24 - 12 oz bottles" ,
UnitPrice = 19 ,
UnitsInStock = 17 ,
UnitsOnOrder = 40 ,
ReorderLevel = 25 ,
Discontinued = true ,
OrderDate = @"2003-03-17" ,
Rating = 5 ,
Locations = new List<NwindDataItem_LocationsItem>()
{
new NwindDataItem_LocationsItem()
{
Shop = @"Super Market" ,
LastInventory = @"2018-09-09"
}}
});
this .Add(new NwindDataItem()
{
ProductID = 3 ,
ProductName = @"Aniseed Syrup" ,
SupplierID = 1 ,
CategoryID = 2 ,
QuantityPerUnit = @"12 - 550 ml bottles" ,
UnitPrice = 10 ,
UnitsInStock = 13 ,
UnitsOnOrder = 70 ,
ReorderLevel = 25 ,
Discontinued = false ,
OrderDate = @"2006-03-17" ,
Rating = 3 ,
Locations = new List<NwindDataItem_LocationsItem>()
{
new NwindDataItem_LocationsItem()
{
Shop = @"Farmer Market" ,
LastInventory = @"2018-04-04"
},
new NwindDataItem_LocationsItem()
{
Shop = @"Street Market" ,
LastInventory = @"2018-12-12"
},
new NwindDataItem_LocationsItem()
{
Shop = @"24/7 Market" ,
LastInventory = @"2018-11-11"
}}
});
this .Add(new NwindDataItem()
{
ProductID = 4 ,
ProductName = @"Chef Antons Cajun Seasoning" ,
SupplierID = 2 ,
CategoryID = 2 ,
QuantityPerUnit = @"48 - 6 oz jars" ,
UnitPrice = 22 ,
UnitsInStock = 53 ,
UnitsOnOrder = 30 ,
ReorderLevel = 0 ,
Discontinued = false ,
OrderDate = @"2016-03-17" ,
Rating = 3 ,
Locations = new List<NwindDataItem_LocationsItem>()
{
new NwindDataItem_LocationsItem()
{
Shop = @"Fun-Tasty Co." ,
LastInventory = @"2018-06-12"
},
new NwindDataItem_LocationsItem()
{
Shop = @"Farmer Market" ,
LastInventory = @"2018-04-04"
},
new NwindDataItem_LocationsItem()
{
Shop = @"Street Market" ,
LastInventory = @"2018-12-12"
}}
});
this .Add(new NwindDataItem()
{
ProductID = 5 ,
ProductName = @"Chef Antons Gumbo Mix" ,
SupplierID = 2 ,
CategoryID = 2 ,
QuantityPerUnit = @"36 boxes" ,
UnitPrice = 21.35 ,
UnitsInStock = 0 ,
UnitsOnOrder = 30 ,
ReorderLevel = 0 ,
Discontinued = true ,
OrderDate = @"2011-11-11" ,
Rating = 5 ,
Locations = new List<NwindDataItem_LocationsItem>()
{
new NwindDataItem_LocationsItem()
{
Shop = @"Super Market" ,
LastInventory = @"2018-09-09"
}}
});
this .Add(new NwindDataItem()
{
ProductID = 6 ,
ProductName = @"Grandmas Boysenberry Spread" ,
SupplierID = 3 ,
CategoryID = 2 ,
QuantityPerUnit = @"12 - 8 oz jars" ,
UnitPrice = 25 ,
UnitsInStock = 0 ,
UnitsOnOrder = 30 ,
ReorderLevel = 25 ,
Discontinued = false ,
OrderDate = @"2017-12-17" ,
Rating = 4 ,
Locations = new List<NwindDataItem_LocationsItem>()
{
new NwindDataItem_LocationsItem()
{
Shop = @"Super Market" ,
LastInventory = @"2018-09-09"
}}
});
this .Add(new NwindDataItem()
{
ProductID = 7 ,
ProductName = @"Uncle Bobs Organic Dried Pears" ,
SupplierID = 3 ,
CategoryID = 7 ,
QuantityPerUnit = @"12 - 1 lb pkgs." ,
UnitPrice = 30 ,
UnitsInStock = 150 ,
UnitsOnOrder = 30 ,
ReorderLevel = 10 ,
Discontinued = false ,
OrderDate = @"2016-07-17" ,
Rating = 5 ,
Locations = new List<NwindDataItem_LocationsItem>()
{
new NwindDataItem_LocationsItem()
{
Shop = @"Fun-Tasty Co." ,
LastInventory = @"2018-06-12"
},
new NwindDataItem_LocationsItem()
{
Shop = @"Farmer Market" ,
LastInventory = @"2018-04-04"
},
new NwindDataItem_LocationsItem()
{
Shop = @"Street Market" ,
LastInventory = @"2018-12-12"
}}
});
this .Add(new NwindDataItem()
{
ProductID = 8 ,
ProductName = @"Northwoods Cranberry Sauce" ,
SupplierID = 3 ,
CategoryID = 2 ,
QuantityPerUnit = @"12 - 12 oz jars" ,
UnitPrice = 40 ,
UnitsInStock = 6 ,
UnitsOnOrder = 30 ,
ReorderLevel = 0 ,
Discontinued = false ,
OrderDate = @"2018-01-17" ,
Rating = 4 ,
Locations = new List<NwindDataItem_LocationsItem>()
{
new NwindDataItem_LocationsItem()
{
Shop = @"Fun-Tasty Co." ,
LastInventory = @"2018-06-12"
},
new NwindDataItem_LocationsItem()
{
Shop = @"Farmer Market" ,
LastInventory = @"2018-04-04"
}}
});
this .Add(new NwindDataItem()
{
ProductID = 9 ,
ProductName = @"Mishi Kobe Niku" ,
SupplierID = 4 ,
CategoryID = 6 ,
QuantityPerUnit = @"18 - 500 g pkgs." ,
UnitPrice = 97 ,
UnitsInStock = 29 ,
UnitsOnOrder = 30 ,
ReorderLevel = 0 ,
Discontinued = true ,
OrderDate = @"2010-02-17" ,
Rating = 4 ,
Locations = new List<NwindDataItem_LocationsItem>()
{
new NwindDataItem_LocationsItem()
{
Shop = @"Farmer Market" ,
LastInventory = @"2018-04-04"
}}
});
this .Add(new NwindDataItem()
{
ProductID = 10 ,
ProductName = @"Ikura" ,
SupplierID = 4 ,
CategoryID = 8 ,
QuantityPerUnit = @"12 - 200 ml jars" ,
UnitPrice = 31 ,
UnitsInStock = 31 ,
UnitsOnOrder = 30 ,
ReorderLevel = 0 ,
Discontinued = false ,
OrderDate = @"2008-05-17" ,
Rating = 3 ,
Locations = new List<NwindDataItem_LocationsItem>()
{
new NwindDataItem_LocationsItem()
{
Shop = @"Wall Market" ,
LastInventory = @"2018-12-06"
}}
});
this .Add(new NwindDataItem()
{
ProductID = 11 ,
ProductName = @"Queso Cabrales" ,
SupplierID = 5 ,
CategoryID = 4 ,
QuantityPerUnit = @"1 kg pkg." ,
UnitPrice = 21 ,
UnitsInStock = 22 ,
UnitsOnOrder = 30 ,
ReorderLevel = 30 ,
Discontinued = false ,
OrderDate = @"2009-01-17" ,
Rating = 5 ,
Locations = new List<NwindDataItem_LocationsItem>()
{
new NwindDataItem_LocationsItem()
{
Shop = @"Fun-Tasty Co." ,
LastInventory = @"2018-06-12"
},
new NwindDataItem_LocationsItem()
{
Shop = @"Farmer Market" ,
LastInventory = @"2018-04-04"
}}
});
this .Add(new NwindDataItem()
{
ProductID = 12 ,
ProductName = @"Queso Manchego La Pastora" ,
SupplierID = 5 ,
CategoryID = 4 ,
QuantityPerUnit = @"10 - 500 g pkgs." ,
UnitPrice = 38 ,
UnitsInStock = 86 ,
UnitsOnOrder = 30 ,
ReorderLevel = 0 ,
Discontinued = false ,
OrderDate = @"2015-11-17" ,
Rating = 3 ,
Locations = new List<NwindDataItem_LocationsItem>()
{
new NwindDataItem_LocationsItem()
{
Shop = @"Farmer Market" ,
LastInventory = @"2018-04-04"
}}
});
this .Add(new NwindDataItem()
{
ProductID = 13 ,
ProductName = @"Konbu" ,
SupplierID = 6 ,
CategoryID = 8 ,
QuantityPerUnit = @"2 kg box" ,
UnitPrice = 6 ,
UnitsInStock = 24 ,
UnitsOnOrder = 30 ,
ReorderLevel = 5 ,
Discontinued = false ,
OrderDate = @"2015-03-17" ,
Rating = 2 ,
Locations = new List<NwindDataItem_LocationsItem>()
{
new NwindDataItem_LocationsItem()
{
Shop = @"Super Market" ,
LastInventory = @"2018-09-09"
}}
});
this .Add(new NwindDataItem()
{
ProductID = 14 ,
ProductName = @"Tofu" ,
SupplierID = 6 ,
CategoryID = 7 ,
QuantityPerUnit = @"40 - 100 g pkgs." ,
UnitPrice = 23.25 ,
UnitsInStock = 35 ,
UnitsOnOrder = 30 ,
ReorderLevel = 0 ,
Discontinued = false ,
OrderDate = @"2017-06-17" ,
Rating = 4 ,
Locations = new List<NwindDataItem_LocationsItem>()
{
new NwindDataItem_LocationsItem()
{
Shop = @"Farmer Market" ,
LastInventory = @"2018-04-04"
},
new NwindDataItem_LocationsItem()
{
Shop = @"Street Market" ,
LastInventory = @"2018-12-12"
}}
});
this .Add(new NwindDataItem()
{
ProductID = 15 ,
ProductName = @"Genen Shouyu" ,
SupplierID = 6 ,
CategoryID = 2 ,
QuantityPerUnit = @"24 - 250 ml bottles" ,
UnitPrice = 15.5 ,
UnitsInStock = 39 ,
UnitsOnOrder = 30 ,
ReorderLevel = 5 ,
Discontinued = false ,
OrderDate = @"2014-03-17" ,
Rating = 4 ,
Locations = new List<NwindDataItem_LocationsItem>()
{
new NwindDataItem_LocationsItem()
{
Shop = @"Local Market" ,
LastInventory = @"2018-07-03"
},
new NwindDataItem_LocationsItem()
{
Shop = @"Wall Market" ,
LastInventory = @"2018-12-06"
}}
});
this .Add(new NwindDataItem()
{
ProductID = 16 ,
ProductName = @"Pavlova" ,
SupplierID = 7 ,
CategoryID = 3 ,
QuantityPerUnit = @"32 - 500 g boxes" ,
UnitPrice = 17.45 ,
UnitsInStock = 29 ,
UnitsOnOrder = 30 ,
ReorderLevel = 10 ,
Discontinued = false ,
OrderDate = @"2018-03-28" ,
Rating = 2 ,
Locations = new List<NwindDataItem_LocationsItem>()
{
new NwindDataItem_LocationsItem()
{
Shop = @"Farmer Market" ,
LastInventory = @"2018-04-04"
},
new NwindDataItem_LocationsItem()
{
Shop = @"Street Market" ,
LastInventory = @"2018-12-12"
},
new NwindDataItem_LocationsItem()
{
Shop = @"24/7 Market" ,
LastInventory = @"2018-11-11"
}}
});
this .Add(new NwindDataItem()
{
ProductID = 17 ,
ProductName = @"Alice Mutton" ,
SupplierID = 7 ,
CategoryID = 6 ,
QuantityPerUnit = @"20 - 1 kg tins" ,
UnitPrice = 39 ,
UnitsInStock = 0 ,
UnitsOnOrder = 30 ,
ReorderLevel = 0 ,
Discontinued = true ,
OrderDate = @"2015-08-17" ,
Rating = 2 ,
Locations = new List<NwindDataItem_LocationsItem>()
{
new NwindDataItem_LocationsItem()
{
Shop = @"Farmer Market" ,
LastInventory = @"2018-04-04"
}}
});
this .Add(new NwindDataItem()
{
ProductID = 18 ,
ProductName = @"Carnarvon Tigers" ,
SupplierID = 7 ,
CategoryID = 8 ,
QuantityPerUnit = @"16 kg pkg." ,
UnitPrice = 62.5 ,
UnitsInStock = 42 ,
UnitsOnOrder = 30 ,
ReorderLevel = 0 ,
Discontinued = false ,
OrderDate = @"2005-09-27" ,
Rating = 2 ,
Locations = new List<NwindDataItem_LocationsItem>()
{
new NwindDataItem_LocationsItem()
{
Shop = @"24/7 Market" ,
LastInventory = @"2018-11-11"
},
new NwindDataItem_LocationsItem()
{
Shop = @"Super Market" ,
LastInventory = @"2018-09-09"
}}
});
this .Add(new NwindDataItem()
{
ProductID = 19 ,
ProductName = @"Teatime Chocolate Biscuits" ,
SupplierID = 8 ,
CategoryID = 3 ,
QuantityPerUnit = @"" ,
UnitPrice = 9.2 ,
UnitsInStock = 25 ,
UnitsOnOrder = 30 ,
ReorderLevel = 5 ,
Discontinued = false ,
OrderDate = @"2001-03-17" ,
Rating = 2 ,
Locations = new List<NwindDataItem_LocationsItem>()
{
new NwindDataItem_LocationsItem()
{
Shop = @"Local Market" ,
LastInventory = @"2018-07-03"
}}
});
this .Add(new NwindDataItem()
{
ProductID = 20 ,
ProductName = @"Sir Rodneys Marmalade" ,
SupplierID = 8 ,
CategoryID = 3 ,
QuantityPerUnit = @"4 - 100 ml jars" ,
UnitPrice = 4.5 ,
UnitsInStock = 40 ,
UnitsOnOrder = 30 ,
ReorderLevel = 0 ,
Discontinued = false ,
OrderDate = @"2005-03-17" ,
Rating = 5 ,
Locations = new List<NwindDataItem_LocationsItem>()
{
new NwindDataItem_LocationsItem()
{
Shop = @"Super Market" ,
LastInventory = @"2018-09-09"
}}
});
}
}
cs コピー using System;
using System.Net.Http;
using System.Collections.Generic;
using System.Threading.Tasks;
using System.Text;
using Microsoft.AspNetCore.Components.WebAssembly.Hosting;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
using IgniteUI.Blazor.Controls;
namespace Infragistics.Samples
{
public class Program
{
public static async Task Main (string [] args )
{
var builder = WebAssemblyHostBuilder.CreateDefault(args);
builder.RootComponents.Add<App>("app" );
builder.Services.AddScoped(sp => new HttpClient { BaseAddress = new Uri(builder.HostEnvironment.BaseAddress) });
builder.Services.AddIgniteUIBlazor(
typeof (IgbInputModule),
typeof (IgbGridModule)
);
await builder.Build().RunAsync();
}
}
}
cs コピー
@using IgniteUI.Blazor.Controls
<div class ="container vertical ig-typography" >
<div class ="container vertical fill" >
<IgbGrid
AutoGenerate ="false"
Name ="grid"
@ref ="grid"
Id ="grid"
Data ="NwindData"
PrimaryKey ="ProductID"
RowEditable ="true" >
<IgbActionStrip
>
<IgbGridEditingActions
AddRow ="true" >
</IgbGridEditingActions >
</IgbActionStrip >
<IgbColumn
Name ="ID"
@ref ="iD"
Field ="ProductID"
Header ="Product ID"
DataType ="GridColumnDataType.Number"
Hidden ="true" >
</IgbColumn >
<IgbColumn
Name ="ReorderLevel"
@ref ="reorderLevel"
Field ="ReorderLevel"
Header ="Reorder Level"
DataType ="GridColumnDataType.Number" >
</IgbColumn >
<IgbColumn
Name ="ProductName"
@ref ="productName"
Field ="ProductName"
Header ="Product Name"
DataType ="GridColumnDataType.String" >
</IgbColumn >
<IgbColumn
Name ="UnitsInStock"
@ref ="unitsInStock"
Field ="UnitsInStock"
Header ="Units In Stock"
DataType ="GridColumnDataType.Number" >
</IgbColumn >
<IgbColumn
Name ="UnitPrice"
@ref ="unitPrice"
Field ="UnitPrice"
Header ="Unit Price"
DataType ="GridColumnDataType.Number"
Sortable ="true" >
</IgbColumn >
<IgbColumn
Name ="OrderDate"
@ref ="orderDate"
Field ="OrderDate"
Header ="Order Date"
DataType ="GridColumnDataType.Date" >
</IgbColumn >
<IgbColumn
Name ="Discontinued"
@ref ="discontinued"
Field ="Discontinued"
Header ="Discontinued"
DataType ="GridColumnDataType.Boolean" >
</IgbColumn >
</IgbGrid >
</div >
</div >
@code {
protected override async Task OnAfterRenderAsync (bool firstRender )
{
var grid = this .grid;
var iD = this .iD;
var reorderLevel = this .reorderLevel;
var productName = this .productName;
var unitsInStock = this .unitsInStock;
var unitPrice = this .unitPrice;
var orderDate = this .orderDate;
var discontinued = this .discontinued;
}
private IgbGrid grid;
private IgbColumn iD;
private IgbColumn reorderLevel;
private IgbColumn productName;
private IgbColumn unitsInStock;
private IgbColumn unitPrice;
private IgbColumn orderDate;
private IgbColumn discontinued;
private NwindData _nwindData = null ;
public NwindData NwindData
{
get
{
if (_nwindData == null )
{
_nwindData = new NwindData();
}
return _nwindData;
}
}
}
razor コピー
このサンプルが気に入りましたか? 完全な Ignite UI for Blazorツールキットにアクセスして、すばやく独自のアプリの作成を開始します。無料でダウンロードできます。
行追加の使用
次に、バインドしたデータ ソースに IgbGrid
を定義をして RowEditable
を true に設定し、編集アクションを有効にした IgbActionStrip
コンポーネントを定義します。AddRow
入力は、行追加 UI を生成するボタンの表示状態を制御します。
<IgbGrid AutoGenerate ="false" Id ="grid" Data ="NwindData" PrimaryKey ="ProductID" RowEditable ="true" >
<IgbColumn Field ="ProductID" Header ="Product ID" DataType ="GridColumnDataType.Number" > </IgbColumn >
<IgbColumn Field ="ReorderLevel" Header ="Reorder Level" DataType ="GridColumnDataType.Number" > </IgbColumn >
<IgbColumn Field ="ProductName" Header ="Product Name" DataType ="GridColumnDataType.String" > </IgbColumn >
<IgbColumn Field ="UnitsInStock" Header ="Units In Stock" DataType ="GridColumnDataType.Number" > </IgbColumn >
<IgbColumn Field ="OrderDate" Header ="Order Date" DataType ="GridColumnDataType.Date" > </IgbColumn >
<IgbColumn Field ="Discontinued" Header ="Discontinued" DataType ="GridColumnDataType.Boolean" > </IgbColumn >
<IgbActionStrip >
<IgbGridEditingActions AddRow ="true" > </IgbGridEditingActions >
</IgbActionStrip >
</IgbGrid >
razor
注 :
プライマリ キーは行追加操作で必須です。
注 :
プライマリ キーを除くすべての列は、デフォルトで行追加 UI で編集可能です。特定の列の編集を無効にする場合、Editable
列の入力を false に設定します。
注 :
[行の追加] のボタンの表示状態を制御する IgbGridEditingActions
入力は、アクション ストリップ コンテキスト (タイプ IgbRowType
を使用して、ボタンが表示するレコードを調整できます。
内部の BaseTransactionService
は Grid
に自動的に提供されます。行の状態が送信またはキャンセルされるまで、保留中のセルの変更を保持します。
プログラムで行の追加を開始
Grid
を使用すると、2 つの異なるパブリック メソッドを使用して、プログラムで行追加 UI を生成できます。1 つは UI が生成される行を指定するための行 ID を受け入れ、もう 1 つはインデックスによって機能します。これらのメソッドを使用して、現在のデータ ビュー内の任意の場所に UI を生成できます。ページの変更や、たとえばフィルターで除外された行の指定はサポートされていません。
BeginAddRowById
を使用するには、RowID
(PK) によって操作のコンテキストとして使用する行を指定する必要があります。このメソッドは、エンドユーザーが指定された行の [行の追加] アクション ストリップ ボタンをクリックしたかのように機能し、その下に UI を生成します。最初のパラメーターに null
を渡すことで、UI をグリッドの最初の行としてス生成させることもできます。
@code {
await this .grid.BeginAddRowByIdAsync('ALFKI' , false );
await this .grid.BeginAddRowByIdAsync(null , false );
}
razor
beginAddRowByIndex
メソッドも同様に機能しますが、UI が生成されるインデックスを指定する必要があります。許可される値の範囲は、0 からデータ ビューのサイズ -1 までです。
@code {
await this .grid.BeginAddRowByIndexAsync(10 );
await this .grid.BeginAddRowByIndexAsync(0 );
}
razor
位置
行追加 UI のデフォルト位置は、エンド ユーザーが [行の追加] ボタンをクリックした行の下にあります。
Grid
がスクロールして、行追加 UI が自動的に完全に表示されます。
行追加 UI のオーバーレイは、スクロール中もその位置を維持します。
動作
行追加 UI は、エンド ユーザーに整合性のある編集エクスペリエンスを提供するように設計されているため、行編集 UI と同じ動作をします。詳細については、Grid 行の編集 のトピックを参照してください。
行追加 UI を介して新しい行が追加された後、その位置や表示状態は、Grid
のソート、フィルタリングおよびグループ化の状態によって決定されます。これらの状態のいずれも適用されていない Grid
では、最後のレコードとして表示されます。スナックバーが短時間表示され、Grid
が表示されていない場合にはエンド ユーザーがコントロールの位置までスクロールするためのボタンが含まれています。
キーボード ナビゲーション
ALT + + - 行を追加するために編集モードに入ります。
機能の統合
行追加オーバーレイのカスタマイズ
テキストのカスタマイズ
行追加オーバーレイのテキストのカスタマイズは、RowAddTextDirective
を使用して可能です。
<IgbGrid Data ="data" PrimaryKey ="ProductID" AutoGenerate ="false" RowEditable ="true" RowAddTextTemplate ="addTextTemplate" >
</IgbGrid >
@code {
private RenderFragment <IgbGridEmptyTemplateContext > addTextTemplate = (context) =>
{
return @<span>Adding Row</span>;
};
}
razor
ボタンのカスタマイズ
行編集オーバーレイのボタンをカスタマイズするには、RowEditActions
テンプレートを使用します。
<IgbGrid Data ="data" PrimaryKey ="ProductID" AutoGenerate ="false" RowEditable ="true" RowEditActionsTemplateScript ="rowEditActionsTemplate" >
</IgbGrid >
//In JavaScript:
igRegisterScript("rowEditActionsTemplate", (endRowEdit) => {
var html = window.igTemplating.html;
return html`<div class ="row-actions" >
<button @click ="${evt => endRowEdit.implicit(false, evt)}" > Cancel</button >
<button @click ="${evt => endRowEdit.implicit(true, evt)}" > Apply</button >
</div > `
}, false);
razor
注 :
RowEditActions
テンプレートを使用すると、オーバーレイ ボタンの編集と追加の両方の編集アクションが変更されます。
スタイル設定
行追加 UI は IgbActionStrip
編集操作のボタン、編集エディター、オーバーレイ、エンドユーザーが新しく追加された行にスクロールできるスナックバーが構成されます。これらのコンポーネントのスタイル設定には、それぞれのトピックのガイドを参照してください。
API リファレンス
その他のリソース
コミュニティに参加して新しいアイデアをご提案ください。