The Ignite UI for Blazor Row Adding feature in Blazor Hierarchical Grid enables users to input and submit new data records without navigating to a separate form or page. With the IgbHierarchicalGrid, users can manipulate data through inline row adding and a powerful API for CRUD operations.
Add an IgbActionStrip component with editing actions enabled in the grid's template. After that hover a row and use the provided button. Finally press ALT + + to spawn the row adding UI.
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; // for registering Ignite UI modulesnamespaceInfragistics.Samples
{
publicclassProgram
{
publicstaticasync 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) });
// registering Ignite UI modules
builder.Services.AddIgniteUIBlazor(
typeof(IgbHierarchicalGridModule),
typeof(IgbActionStripModule)
);
await builder.Build().RunAsync();
}
}
}cs
using System;
using System.Collections.Generic;
publicclassSingersDataItem
{
publicdouble ID { get; set; }
publicstring Artist { get; set; }
publicstring Photo { get; set; }
publicdouble Debut { get; set; }
publicdouble GrammyNominations { get; set; }
publicdouble GrammyAwards { get; set; }
publicbool HasGrammyAward { get; set; }
public List<SingersDataItem_ToursItem> Tours { get; set; }
public List<SingersDataItem_AlbumsItem> Albums { get; set; }
}
publicclassSingersDataItem_ToursItem
{
publicstring Tour { get; set; }
publicstring StartedOn { get; set; }
publicstring Location { get; set; }
publicstring Headliner { get; set; }
publicstring TouredBy { get; set; }
}
publicclassSingersDataItem_AlbumsItem
{
publicstring Album { get; set; }
publicstring LaunchDate { get; set; }
publicdouble BillboardReview { get; set; }
publicdouble USBillboard200 { get; set; }
publicstring Artist { get; set; }
}
publicclassSingersData
: List<SingersDataItem>
{
publicSingersData()
{
this.Add(new SingersDataItem()
{
ID = 0,
Artist = @"Naomí Yepes",
Photo = @"https://static.infragistics.com/xplatform/images/people/names/naomi.jpg",
Debut = 2011,
GrammyNominations = 6,
GrammyAwards = 0,
HasGrammyAward = false,
Tours = new List<SingersDataItem_ToursItem>()
{
new SingersDataItem_ToursItem()
{
Tour = @"Faithful Tour",
StartedOn = @"Sep 12",
Location = @"Worldwide",
Headliner = @"NO",
TouredBy = @"Naomí Yepes"
},
new SingersDataItem_ToursItem()
{
Tour = @"City Jam Sessions",
StartedOn = @"Aug 13",
Location = @"North America",
Headliner = @"YES",
TouredBy = @"Naomí Yepes"
},
new SingersDataItem_ToursItem()
{
Tour = @"Christmas NYC 2013",
StartedOn = @"Dec 13",
Location = @"United States",
Headliner = @"NO",
TouredBy = @"Naomí Yepes"
},
new SingersDataItem_ToursItem()
{
Tour = @"Christmas NYC 2014",
StartedOn = @"Dec 14",
Location = @"North America",
Headliner = @"NO",
TouredBy = @"Naomí Yepes"
},
new SingersDataItem_ToursItem()
{
Tour = @"Watermelon Tour",
StartedOn = @"Feb 15",
Location = @"Worldwide",
Headliner = @"YES",
TouredBy = @"Naomí Yepes"
},
new SingersDataItem_ToursItem()
{
Tour = @"Christmas NYC 2016",
StartedOn = @"Dec 16",
Location = @"United States",
Headliner = @"NO",
TouredBy = @"Naomí Yepes"
},
new SingersDataItem_ToursItem()
{
Tour = @"The Dragon Tour",
StartedOn = @"Feb 17",
Location = @"Worldwide",
Headliner = @"NO",
TouredBy = @"Naomí Yepes"
},
new SingersDataItem_ToursItem()
{
Tour = @"Organic Sessions",
StartedOn = @"Aug 18",
Location = @"United States, England",
Headliner = @"YES",
TouredBy = @"Naomí Yepes"
},
new SingersDataItem_ToursItem()
{
Tour = @"Hope World Tour",
StartedOn = @"Mar 19",
Location = @"Worldwide",
Headliner = @"NO",
TouredBy = @"Naomí Yepes"
}}
,
Albums = new List<SingersDataItem_AlbumsItem>()
{
new SingersDataItem_AlbumsItem()
{
Album = @"Initiation",
LaunchDate = @"September 3, 2013",
BillboardReview = 86,
USBillboard200 = 1,
Artist = @"Naomí Yepes"
},
new SingersDataItem_AlbumsItem()
{
Album = @"Dream Driven",
LaunchDate = @"August 25, 2014",
BillboardReview = 81,
USBillboard200 = 1,
Artist = @"Naomí Yepes"
},
new SingersDataItem_AlbumsItem()
{
Album = @"The dragon journey",
LaunchDate = @"May 20, 2016",
BillboardReview = 60,
USBillboard200 = 2,
Artist = @"Naomí Yepes"
},
new SingersDataItem_AlbumsItem()
{
Album = @"Organic me",
LaunchDate = @"August 17, 2018",
BillboardReview = 82,
USBillboard200 = 1,
Artist = @"Naomí Yepes"
},
new SingersDataItem_AlbumsItem()
{
Album = @"Curiosity",
LaunchDate = @"December 7, 2019",
BillboardReview = 75,
USBillboard200 = 12,
Artist = @"Naomí Yepes"
}}
});
this.Add(new SingersDataItem()
{
ID = 1,
Artist = @"Babila Ebwélé",
Photo = @"https://static.infragistics.com/xplatform/images/people/names/babila.jpg",
Debut = 2009,
GrammyNominations = 0,
GrammyAwards = 11,
HasGrammyAward = true,
Tours = new List<SingersDataItem_ToursItem>()
{
new SingersDataItem_ToursItem()
{
Tour = @"The last straw",
StartedOn = @"May 09",
Location = @"Europe, Asia",
Headliner = @"NO",
TouredBy = @"Babila Ebwélé"
},
new SingersDataItem_ToursItem()
{
Tour = @"No foundations",
StartedOn = @"Jun 04",
Location = @"United States, Europe",
Headliner = @"YES",
TouredBy = @"Babila Ebwélé"
},
new SingersDataItem_ToursItem()
{
Tour = @"Crazy eyes",
StartedOn = @"Jun 08",
Location = @"North America",
Headliner = @"NO",
TouredBy = @"Babila Ebwélé"
},
new SingersDataItem_ToursItem()
{
Tour = @"Zero gravity",
StartedOn = @"Apr 19",
Location = @"United States",
Headliner = @"NO",
TouredBy = @"Babila Ebwélé"
},
new SingersDataItem_ToursItem()
{
Tour = @"Battle with myself",
StartedOn = @"Mar 08",
Location = @"North America",
Headliner = @"YES",
TouredBy = @"Babila Ebwélé"
}}
,
Albums = new List<SingersDataItem_AlbumsItem>()
{
new SingersDataItem_AlbumsItem()
{
Album = @"Pushing up daisies",
LaunchDate = @"May 31, 2000",
BillboardReview = 86,
USBillboard200 = 42,
Artist = @"Babila Ebwélé"
},
new SingersDataItem_AlbumsItem()
{
Album = @"Death's dead",
LaunchDate = @"June 8, 2016",
BillboardReview = 85,
USBillboard200 = 95,
Artist = @"Babila Ebwélé"
}}
});
this.Add(new SingersDataItem()
{
ID = 2,
Artist = @"Ahmad Nazeri",
Photo = @"https://static.infragistics.com/xplatform/images/people/names/ahmad.jpg",
Debut = 2004,
GrammyNominations = 3,
GrammyAwards = 1,
HasGrammyAward = true,
Tours = new List<SingersDataItem_ToursItem>()
{
}
,
Albums = new List<SingersDataItem_AlbumsItem>()
{
new SingersDataItem_AlbumsItem()
{
Album = @"Emergency",
LaunchDate = @"March 6, 2004",
BillboardReview = 98,
USBillboard200 = 69,
Artist = @"Ahmad Nazeri"
},
new SingersDataItem_AlbumsItem()
{
Album = @"Bursting bubbles",
LaunchDate = @"April 17, 2006",
BillboardReview = 69,
USBillboard200 = 39,
Artist = @"Ahmad Nazeri"
}}
});
this.Add(new SingersDataItem()
{
ID = 3,
Artist = @"Kimmy McIlmorie",
Photo = @"https://static.infragistics.com/xplatform/images/people/names/kimmy.jpg",
Debut = 2007,
GrammyNominations = 21,
GrammyAwards = 3,
HasGrammyAward = true,
Tours = new List<SingersDataItem_ToursItem>()
{
}
,
Albums = new List<SingersDataItem_AlbumsItem>()
{
new SingersDataItem_AlbumsItem()
{
Album = @"Here we go again",
LaunchDate = @"November 18, 2017",
BillboardReview = 68,
USBillboard200 = 1,
Artist = @"Kimmy McIlmorie"
}}
});
this.Add(new SingersDataItem()
{
ID = 4,
Artist = @"Mar Rueda",
Photo = @"https://static.infragistics.com/xplatform/images/people/names/mar.jpg",
Debut = 1996,
GrammyNominations = 14,
GrammyAwards = 2,
HasGrammyAward = true,
Tours = new List<SingersDataItem_ToursItem>()
{
}
,
Albums = new List<SingersDataItem_AlbumsItem>()
{
}
});
this.Add(new SingersDataItem()
{
ID = 5,
Artist = @"Izabella Tabakova",
Photo = @"https://static.infragistics.com/xplatform/images/people/names/izabella.jpg",
Debut = 2017,
GrammyNominations = 7,
GrammyAwards = 11,
HasGrammyAward = true,
Tours = new List<SingersDataItem_ToursItem>()
{
new SingersDataItem_ToursItem()
{
Tour = @"Final breath",
StartedOn = @"Jun 13",
Location = @"Europe",
Headliner = @"YES",
TouredBy = @"Izabella Tabakova"
},
new SingersDataItem_ToursItem()
{
Tour = @"Once bitten",
StartedOn = @"Dec 18",
Location = @"Australia, United States",
Headliner = @"NO",
TouredBy = @"Izabella Tabakova"
},
new SingersDataItem_ToursItem()
{
Tour = @"Code word",
StartedOn = @"Sep 19",
Location = @"United States, Europe",
Headliner = @"NO",
TouredBy = @"Izabella Tabakova"
},
new SingersDataItem_ToursItem()
{
Tour = @"Final draft",
StartedOn = @"Sep 17",
Location = @"United States, Europe",
Headliner = @"YES",
TouredBy = @"Izabella Tabakova"
}}
,
Albums = new List<SingersDataItem_AlbumsItem>()
{
new SingersDataItem_AlbumsItem()
{
Album = @"Once bitten",
LaunchDate = @"July 16, 2007",
BillboardReview = 79,
USBillboard200 = 53,
Artist = @"Izabella Tabakova"
},
new SingersDataItem_AlbumsItem()
{
Album = @"Your graciousness",
LaunchDate = @"November 17, 2004",
BillboardReview = 69,
USBillboard200 = 30,
Artist = @"Izabella Tabakova"
},
new SingersDataItem_AlbumsItem()
{
Album = @"Dark matters",
LaunchDate = @"November 3, 2002",
BillboardReview = 79,
USBillboard200 = 85,
Artist = @"Izabella Tabakova"
}}
});
this.Add(new SingersDataItem()
{
ID = 6,
Artist = @"Nguyễn Diệp Chi",
Photo = @"https://static.infragistics.com/xplatform/images/people/names/nguyen.jpg",
Debut = 1992,
GrammyNominations = 4,
GrammyAwards = 2,
HasGrammyAward = true,
Tours = new List<SingersDataItem_ToursItem>()
{
}
,
Albums = new List<SingersDataItem_AlbumsItem>()
{
new SingersDataItem_AlbumsItem()
{
Album = @"Library of liberty",
LaunchDate = @"December 22, 2003",
BillboardReview = 93,
USBillboard200 = 5,
Artist = @"Nguyễn Diệp Chi"
}}
});
this.Add(new SingersDataItem()
{
ID = 7,
Artist = @"Eva Lee",
Photo = @"https://static.infragistics.com/xplatform/images/people/names/eva.jpg",
Debut = 2008,
GrammyNominations = 2,
GrammyAwards = 0,
HasGrammyAward = false,
Tours = new List<SingersDataItem_ToursItem>()
{
}
,
Albums = new List<SingersDataItem_AlbumsItem>()
{
new SingersDataItem_AlbumsItem()
{
Album = @"Just a tease",
LaunchDate = @"May 3, 2001",
BillboardReview = 91,
USBillboard200 = 29,
Artist = @"Eva Lee"
}}
});
this.Add(new SingersDataItem()
{
ID = 8,
Artist = @"Siri Jakobsson",
Photo = @"https://static.infragistics.com/xplatform/images/people/names/siri.jpg",
Debut = 1990,
GrammyNominations = 2,
GrammyAwards = 8,
HasGrammyAward = true,
Tours = new List<SingersDataItem_ToursItem>()
{
new SingersDataItem_ToursItem()
{
Tour = @"Basket case",
StartedOn = @"Jan 07",
Location = @"Europe, Asia",
Headliner = @"NO",
TouredBy = @"Siri Jakobsson"
},
new SingersDataItem_ToursItem()
{
Tour = @"The bigger fish",
StartedOn = @"Dec 07",
Location = @"United States, Europe",
Headliner = @"YES",
TouredBy = @"Siri Jakobsson"
},
new SingersDataItem_ToursItem()
{
Tour = @"Missed the boat",
StartedOn = @"Jun 09",
Location = @"Europe, Asia",
Headliner = @"NO",
TouredBy = @"Siri Jakobsson"
},
new SingersDataItem_ToursItem()
{
Tour = @"Equivalent exchange",
StartedOn = @"Feb 06",
Location = @"United States, Europe",
Headliner = @"YES",
TouredBy = @"Siri Jakobsson"
},
new SingersDataItem_ToursItem()
{
Tour = @"Damage control",
StartedOn = @"Oct 11",
Location = @"Australia, United States",
Headliner = @"NO",
TouredBy = @"Siri Jakobsson"
}}
,
Albums = new List<SingersDataItem_AlbumsItem>()
{
new SingersDataItem_AlbumsItem()
{
Album = @"Under the bus",
LaunchDate = @"May 14, 2000",
BillboardReview = 67,
USBillboard200 = 67,
Artist = @"Siri Jakobsson"
}}
});
this.Add(new SingersDataItem()
{
ID = 9,
Artist = @"Pablo Cambeiro",
Photo = @"https://static.infragistics.com/xplatform/images/people/names/pablo.jpg",
Debut = 2011,
GrammyNominations = 5,
GrammyAwards = 0,
HasGrammyAward = false,
Tours = new List<SingersDataItem_ToursItem>()
{
new SingersDataItem_ToursItem()
{
Tour = @"Beads",
StartedOn = @"May 11",
Location = @"Worldwide",
Headliner = @"NO",
TouredBy = @"Pablo Cambeiro"
},
new SingersDataItem_ToursItem()
{
Tour = @"Concept art",
StartedOn = @"Dec 18",
Location = @"United States",
Headliner = @"YES",
TouredBy = @"Pablo Cambeiro"
},
new SingersDataItem_ToursItem()
{
Tour = @"Glass shoe",
StartedOn = @"Jan 20",
Location = @"Worldwide",
Headliner = @"YES",
TouredBy = @"Pablo Cambeiro"
},
new SingersDataItem_ToursItem()
{
Tour = @"Pushing buttons",
StartedOn = @"Feb 15",
Location = @"Europe, Asia",
Headliner = @"NO",
TouredBy = @"Pablo Cambeiro"
},
new SingersDataItem_ToursItem()
{
Tour = @"Dark matters",
StartedOn = @"Jan 04",
Location = @"Australia, United States",
Headliner = @"YES",
TouredBy = @"Pablo Cambeiro"
},
new SingersDataItem_ToursItem()
{
Tour = @"Greener grass",
StartedOn = @"Sep 09",
Location = @"United States, Europe",
Headliner = @"NO",
TouredBy = @"Pablo Cambeiro"
},
new SingersDataItem_ToursItem()
{
Tour = @"Apparatus",
StartedOn = @"Nov 16",
Location = @"Europe",
Headliner = @"NO",
TouredBy = @"Pablo Cambeiro"
}}
,
Albums = new List<SingersDataItem_AlbumsItem>()
{
new SingersDataItem_AlbumsItem()
{
Album = @"Fluke",
LaunchDate = @"August 4, 2017",
BillboardReview = 93,
USBillboard200 = 98,
Artist = @"Pablo Cambeiro"
},
new SingersDataItem_AlbumsItem()
{
Album = @"Crowd control",
LaunchDate = @"August 26, 2003",
BillboardReview = 68,
USBillboard200 = 84,
Artist = @"Pablo Cambeiro"
}}
});
this.Add(new SingersDataItem()
{
ID = 10,
Artist = @"Athar Malakooti",
Photo = @"https://static.infragistics.com/xplatform/images/people/names/athar.jpg",
Debut = 2017,
GrammyNominations = 0,
GrammyAwards = 0,
HasGrammyAward = false,
Tours = new List<SingersDataItem_ToursItem>()
{
}
,
Albums = new List<SingersDataItem_AlbumsItem>()
{
new SingersDataItem_AlbumsItem()
{
Album = @"Pushing up daisies",
LaunchDate = @"February 24, 2016",
BillboardReview = 74,
USBillboard200 = 77,
Artist = @"Athar Malakooti"
}}
});
this.Add(new SingersDataItem()
{
ID = 11,
Artist = @"Marti Valencia",
Photo = @"https://static.infragistics.com/xplatform/images/people/names/marti.jpg",
Debut = 2004,
GrammyNominations = 1,
GrammyAwards = 1,
HasGrammyAward = true,
Tours = new List<SingersDataItem_ToursItem>()
{
new SingersDataItem_ToursItem()
{
Tour = @"Cat eat cat world",
StartedOn = @"Sep 00",
Location = @"Worldwide",
Headliner = @"YES",
TouredBy = @"Marti Valencia"
},
new SingersDataItem_ToursItem()
{
Tour = @"Final straw",
StartedOn = @"Sep 06",
Location = @"United States, Europe",
Headliner = @"NO",
TouredBy = @"Marti Valencia"
}}
,
Albums = new List<SingersDataItem_AlbumsItem>()
{
new SingersDataItem_AlbumsItem()
{
Album = @"Nemesis",
LaunchDate = @"June 30, 2004",
BillboardReview = 94,
USBillboard200 = 9,
Artist = @"Marti Valencia"
},
new SingersDataItem_AlbumsItem()
{
Album = @"First chance",
LaunchDate = @"January 7, 2019",
BillboardReview = 96,
USBillboard200 = 19,
Artist = @"Marti Valencia"
},
new SingersDataItem_AlbumsItem()
{
Album = @"God's advocate",
LaunchDate = @"April 29, 2007",
BillboardReview = 66,
USBillboard200 = 37,
Artist = @"Marti Valencia"
}}
});
this.Add(new SingersDataItem()
{
ID = 12,
Artist = @"Alicia Stanger",
Photo = @"https://static.infragistics.com/xplatform/images/people/names/alicia.jpg",
Debut = 2010,
GrammyNominations = 1,
GrammyAwards = 0,
HasGrammyAward = false,
Tours = new List<SingersDataItem_ToursItem>()
{
}
,
Albums = new List<SingersDataItem_AlbumsItem>()
{
new SingersDataItem_AlbumsItem()
{
Album = @"Forever alone",
LaunchDate = @"November 3, 2005",
BillboardReview = 82,
USBillboard200 = 7,
Artist = @"Alicia Stanger"
}}
});
this.Add(new SingersDataItem()
{
ID = 13,
Artist = @"Peter Taylor",
Photo = @"https://static.infragistics.com/xplatform/images/people/names/peter.jpg",
Debut = 2005,
GrammyNominations = 0,
GrammyAwards = 2,
HasGrammyAward = true,
Tours = new List<SingersDataItem_ToursItem>()
{
new SingersDataItem_ToursItem()
{
Tour = @"Love",
StartedOn = @"Jun 04",
Location = @"Europe, Asia",
Headliner = @"YES",
TouredBy = @"Peter Taylor"
},
new SingersDataItem_ToursItem()
{
Tour = @"Fault of treasures",
StartedOn = @"Oct 13",
Location = @"North America",
Headliner = @"NO",
TouredBy = @"Peter Taylor"
},
new SingersDataItem_ToursItem()
{
Tour = @"For eternity",
StartedOn = @"Mar 05",
Location = @"United States",
Headliner = @"YES",
TouredBy = @"Peter Taylor"
},
new SingersDataItem_ToursItem()
{
Tour = @"Time flies",
StartedOn = @"Jun 03",
Location = @"North America",
Headliner = @"NO",
TouredBy = @"Peter Taylor"
},
new SingersDataItem_ToursItem()
{
Tour = @"Highest difficulty",
StartedOn = @"Nov 01",
Location = @"Worldwide",
Headliner = @"YES",
TouredBy = @"Peter Taylor"
},
new SingersDataItem_ToursItem()
{
Tour = @"Sleeping dogs",
StartedOn = @"May 04",
Location = @"United States, Europe",
Headliner = @"NO",
TouredBy = @"Peter Taylor"
}}
,
Albums = new List<SingersDataItem_AlbumsItem>()
{
new SingersDataItem_AlbumsItem()
{
Album = @"Decisions decisions",
LaunchDate = @"April 10, 2008",
BillboardReview = 85,
USBillboard200 = 35,
Artist = @"Peter Taylor"
},
new SingersDataItem_AlbumsItem()
{
Album = @"Climate changed",
LaunchDate = @"June 20, 2015",
BillboardReview = 66,
USBillboard200 = 89,
Artist = @"Peter Taylor"
}}
});
}
}cs
@using IgniteUI.Blazor.Controls<divclass="container vertical ig-typography"><divclass="container vertical fill"><IgbHierarchicalGridAutoGenerate="false"Data="SingersData"Id="hGrid"Name="hGrid"
@ref="hGrid"PrimaryKey="ID"RowEditable="true"><IgbActionStrip
><IgbGridEditingActionsAddRow="true"></IgbGridEditingActions></IgbActionStrip><IgbColumnField="Artist"Header="Artist"DataType="GridColumnDataType.String"Resizable="true"></IgbColumn><IgbColumnField="Debut"Header="Debut"DataType="GridColumnDataType.Number"MinWidth="88px"MaxWidth="230px"Resizable="true"></IgbColumn><IgbColumnField="GrammyNominations"Header="Grammy Nominations"DataType="GridColumnDataType.String"Resizable="true"></IgbColumn><IgbColumnField="GrammyAwards"Header="Grammy Awards"DataType="GridColumnDataType.String"Resizable="true"></IgbColumn><IgbRowIslandChildDataKey="Albums"AutoGenerate="false"PrimaryKey="Album"RowEditable="true"><IgbColumnField="Album"Header="Album"DataType="GridColumnDataType.String"Resizable="true"></IgbColumn><IgbColumnField="LaunchDate"Header="Launch Date"DataType="GridColumnDataType.Date"Resizable="true"></IgbColumn><IgbColumnField="BillboardReview"Header="Billboard Review"DataType="GridColumnDataType.String"Resizable="true"></IgbColumn><IgbColumnField="USBillboard200"Header="US Billboard 200"DataType="GridColumnDataType.String"Resizable="true"></IgbColumn><IgbRowIslandChildDataKey="Songs"AutoGenerate="false"PrimaryKey="Title"RowEditable="true"><IgbActionStrip
><IgbGridEditingActionsAddRow="true"></IgbGridEditingActions></IgbActionStrip><IgbColumnField="Number"Header="No."DataType="GridColumnDataType.String"Resizable="true"></IgbColumn><IgbColumnField="Title"Header="Title"DataType="GridColumnDataType.String"Resizable="true"></IgbColumn><IgbColumnField="Released"Header="Released"DataType="GridColumnDataType.String"Resizable="true"></IgbColumn><IgbColumnField="Genre"Header="Genre"DataType="GridColumnDataType.String"Resizable="true"></IgbColumn></IgbRowIsland></IgbRowIsland><IgbRowIslandChildDataKey="Tours"AutoGenerate="false"PrimaryKey="Tour"RowEditable="true"><IgbActionStrip
><IgbGridEditingActionsAddRow="true"></IgbGridEditingActions></IgbActionStrip><IgbColumnField="Tour"Header="Tour"DataType="GridColumnDataType.String"Resizable="true"></IgbColumn><IgbColumnField="StartedOn"Header="Started on"DataType="GridColumnDataType.String"Resizable="true"></IgbColumn><IgbColumnField="Location"Header="Location"DataType="GridColumnDataType.String"Resizable="true"></IgbColumn><IgbColumnField="Headliner"Header="Headliner"DataType="GridColumnDataType.String"Resizable="true"></IgbColumn></IgbRowIsland></IgbHierarchicalGrid></div></div>@code {protectedoverrideasync Task OnAfterRenderAsync(bool firstRender)
{
var hGrid = this.hGrid;
}
private IgbHierarchicalGrid hGrid;
private SingersData _singersData = null;
public SingersData SingersData
{
get
{
if (_singersData == null)
{
_singersData = new SingersData();
}
return _singersData;
}
}
}razor
/*
CSS styles are loaded from the shared CSS file located at:
https://static.infragistics.com/xplatform/css/samples/
*/css
Like this sample? Get access to our complete Ignite UI for Blazor toolkit and start building your own apps in minutes. Download it for free.
Row Adding Usage
Then define a IgbHierarchicalGrid with bound data source, RowEditable set to true and an IgbActionStrip component with editing actions enabled. The AddRow input controls the visibility of the button that spawns the row adding UI.
<IgbHierarchicalGridAutoGenerate="false"Id="hGrid"PrimaryKey="Debut"RowEditable="true"><IgbColumnField="Artist"Header="Artist"DataType="GridColumnDataType.String"></IgbColumn><IgbColumnField="HasGrammyAward"Header="Has Grammy Award"DataType="GridColumnDataType.Boolean"></IgbColumn><IgbColumnField="Debut"Header="Debut"DataType="GridColumnDataType.Number"></IgbColumn><IgbColumnField="GrammyNominations"Header="Grammy Nominations"DataType="GridColumnDataType.Number"></IgbColumn><IgbColumnField="GrammyAwards"Header="Grammy Awards"DataType="GridColumnDataType.Number"></IgbColumn><IgbActionStrip><IgbGridEditingActionsAddRow="true"></IgbGridEditingActions></IgbActionStrip><IgbRowIslandAutoGenerate="false"Key="Albums"PrimaryKey="USBillboard200"RowEditable="true"><IgbColumnField="Album"Header="Album"DataType="GridColumnDataType.Number"></IgbColumn><IgbColumnField="LaunchDate"Header="Launch Date"DataType="GridColumnDataType.Date"></IgbColumn><IgbColumnField="BillboardReview"Header="Billboard Review"DataType="GridColumnDataType.Number"></IgbColumn><IgbColumnField="USBillboard200"Header="US Billboard 200"DataType="GridColumnDataType.Number"></IgbColumn><IgbColumnField="GrammyAwards"Header="Grammy Awards"DataType="GridColumnDataType.Number"></IgbColumn><IgbRowIslandAutoGenerate="false"Key="Songs"PrimaryKey="Number"RowEditable="true"><IgbColumnField="Number"Header="Number"DataType="GridColumnDataType.String"></IgbColumn><IgbColumnField="Title"DataType="GridColumnDataType.String"></IgbColumn><IgbColumnField="Released"DataType="GridColumnDataType.Date"></IgbColumn><IgbColumnField="Genre"DataType="GridColumnDataType.String"></IgbColumn><IgbActionStrip><IgbGridEditingActionsAddRow="true"></IgbGridEditingActions></IgbActionStrip></IgbRowIsland><IgbActionStrip><IgbGridEditingActionsAddRow="true"></IgbGridEditingActions></IgbActionStrip></IgbRowIsland></IgbHierarchicalGrid>razor
Note:
Setting primary key is mandatory for row adding operations.
Note:
Every column excluding the primary key one is editable in the row adding UI by default. If you want to disable editing for a specific column, then you have to set the Editable column's input to false.
Note:
The IgbGridEditingActions input controlling the visibility of the add row button may use the action strip context (which is of type IgbRowType to fine tune which records the button shows for.
The internal BaseTransactionService is automatically provided for IgbHierarchicalGrid. It holds pending cell changes until the row state is submitted or cancelled.
Start Row Adding Programmatically
IgbHierarchicalGrid allows to programmatically spawn the add row UI by using two different public methods. One that accepts a row ID for specifying the row under which the UI should spawn and another that works by index. You can use these methods to spawn the UI anywhere within the current data view. Changing the page or specifying a row that is e.g. filtered out is not supported.
Using BeginAddRowById requires you to specify the row to use as context for the operation by its RowID (PK). The method then functions as though the end-user clicked on the add row action strip button for the specified row, spawning the UI under it. You can also make the UI spawn as the very first row in the grid by passing null for the first parameter.
@code {awaitthis.grid.BeginAddRowByIdAsync('ALFKI', false); // Spawns the add row UI under the row with PK 'ALFKI'awaitthis.grid.BeginAddRowByIdAsync(null, false); // Spawns the add row UI as the first record}razor
The beginAddRowByIndex method works similarly but requires you to specify the index at which the UI should spawn. Allowed values range between 0 and the size of the data view - 1.
@code {awaitthis.grid.BeginAddRowByIndexAsync(10); // Spawns the add row UI at index 10awaitthis.grid.BeginAddRowByIndexAsync(0); // Spawns the add row UI as the first record}razor
Positioning
The default position of row add UI is below the row that the end user clicked the add row button for.
The IgbHierarchicalGrid scrolls to fully display the add row UI automatically.
The overlay for the add row UI maintains its position during scrolling.
Behavior
The add row UI has the same behavior as the row editing one as they are designed to provide a consistent editing experience to end users. Please, refer to the Hierarchical Grid Row Editing topic for more information.
After a new row is added through the row adding UI, its position and/or visibility is determined by the sorting, filtering and grouping state of the IgbHierarchicalGrid. In a IgbHierarchicalGrid that does not have any of these states applied, it appears as the last record. A snackbar is briefly displayed containing a button the end user may use to scroll the IgbHierarchicalGrid to its position if it is not in view.
Keyboard Navigation
ALT + + - Enters edit mode for adding a row
ESC exits row adding mode without submitting any changes
TAB move focus from one editable cell in the row to the next and from the right-most editable cell to the CANCEL and DONE buttons. Navigation from DONE button goes to the left-most editable cell within the currently edited row.
Feature Integration
Any row adding operation will stop if the data view of the IgbHierarchicalGrid gets modified. Any changes made by the end user are submitted. Operations that change the data view include but are not limited to sorting, grouping, filtering, paging, etc.
Summaries are updated after the row add operation finishes. The same is valid for the other data view dependant features such as sorting, filtering, etc.
When spawning the UI for the IgbHierarchicalGrid, any child layout currently expanded for a row that the end user clicks the add row button for is collapsed.
Customizing Row Adding Overlay
Customizing Text
Customizing the text of the row adding overlay is possible using the RowAddTextDirective.
Note:
Using RowEditActions template will change edit actions for both editing and adding overlay buttons.
Styling
The row adding UI comprises the buttons in the IgbActionStrip editing actions, the editing editors and overlay, as well as the snackbar which allows end users to scroll to the newly added row. To style these components you may refer to these comprehensive guides in their respective topics: