Home
PERENDERnew
Theme
Form
Basic components
PDF viewer
chartsnew
Installation
line
File browser
Rich text
Grid

1. Demo AstrolGrid

Note
In this example, confirmations, notifications, and buttons are implemented. It is advisable to refer to the documentation of each component for more details.
Id
Full name texto mas largo de ejemplo en un tabla ast
Points
Maritial status
Sex
Age
Date
1
Juan Pérez
34.56
Widower
True
25
1/1/2022 12:00:00 AM
2
María García
23.14
Married
False
32
3/15/2021 12:00:00 AM
3
Pedro Rodríguez
36.32
Single
True
45
6/30/2020 12:00:00 AM
4
Laura Fernández
56.09
Divorced
False
19
2/28/2022 12:00:00 AM
5
Carlos Sánchez
12.05
Married
True
56
12/1/2019 12:00:00 AM
página de 4
@using Astrol.Component.Basic.Grid
@using Astrol.Component.Basic.Button
@using Astrol.Component.Basic.Confirm
@using Astrol.Entities.Basic.UI.Grid
@using Astrol.Entities.Basic.Response
@using Astrol.Entities.Basic.Static.Notification
@using Astrol.Entities.Basic.UI
@using Astrol.JSInterop.Base
@inject AstrolJSInterop jsI
 
<AstrolConfirm @ref="_conf" />
<AstrolGrid TItem="Client" PageSize="5" Data="dataList" @ref="_grid">
 <Columns>
 <Column Name="@nameof(Client.Id)" Title="Id" Width="20px" Sortable="true">
 @{<span>@context.Id</span>}
 </Column>
 <Column Name="@nameof(Client.FullName)" Title="Full name" Sortable="true" Filtrable="true" />
 <Column ClassHead="blue-head" ClassRow="blue-row" Name="@nameof(Client.Points)" Title="Points" Sortable="true" Filtrable="true" />
 <Column Name="@nameof(Client.MaritialStatus)" Title="Maritial status" Sortable="true" Filtrable="true" />
 <Column Name="@nameof(Client.Sex)" Title="Sex" Width="80px" Sortable="true" Filtrable="true" />
 <Column Name="@nameof(Client.Age)" Title="Age" Sortable="false" Filtrable="true" />
 <Column Name="@nameof(Client.RegistrationDate)" Title="Date" Sortable="true" Filtrable="true" />
 <Column Title="Options" Width="30px">
 <AstrolButton Icon="astrol-trash" Style="AstrolStyle.Red" OnClick="x=>DeleteItem(context)" />
 </Column>
 </Columns>
</AstrolGrid>
<style>
 .blue-head {
 background: #0094ff31;
 }
 .blue-row {
 background: #0094ff12;
 }
</style>
@code {
 private AstrolGrid<Client> _grid;
 private AstrolConfirm _conf;
 private List<Client> dataList = new List<Client> {
 new Client { Id = 1, Points= 34.56F, Name = "Juan", Surnames = "Pérez", Sex = true, MaritialStatus = MaritialStatus.Widower, Age = 25, RegistrationDate = new DateTime(2022, 1, 1) },
 new Client { Id = 2, Points= 23.14F, Name = "María", Surnames = "García", Sex = false, MaritialStatus = MaritialStatus.Married, Age = 32, RegistrationDate = new DateTime(2021, 3, 15) },
 new Client { Id = 3, Points= 36.32F, Name = "Pedro", Surnames = "Rodríguez", Sex = true, Age = 45, MaritialStatus = MaritialStatus.Single, RegistrationDate = new DateTime(2020, 6, 30) },
 new Client { Id = 4, Points= 56.09F , Name = "Laura", Surnames = "Fernández", Sex = false, Age = 19, MaritialStatus = MaritialStatus.Divorced,RegistrationDate = new DateTime(2022, 2, 28) },
 new Client { Id = 5, Points= 12.05F, Name = "Carlos", Surnames = "Sánchez", Sex = true, Age = 56,MaritialStatus = MaritialStatus.Married, RegistrationDate = new DateTime(2019, 12, 1) },
 new Client { Id = 6,Points= 15.26F, Name = "Ana", Surnames = "Gómez", Age = 29, Sex = false, RegistrationDate = new DateTime(2021, 7, 10) },
 new Client { Id = 7,Points= 14.34F , Name = "Pablo", Surnames = "Martínez", Sex = true, Age = 41, MaritialStatus = MaritialStatus.Married, RegistrationDate = new DateTime(2022, 4, 5) },
 new Client { Id = 8,Points= 5.2F, Name = "Lucía", Surnames = "Jiménez", Age = 22,Sex = false, RegistrationDate = new DateTime(2023, 1, 2) },
 new Client { Id = 9,Points= 88.53F, Name = "Javier", Surnames = "Hernández",Sex = true, Age = 37,MaritialStatus = MaritialStatus.Married, RegistrationDate = new DateTime(2022, 9, 15) },
 new Client { Id = 10,Points= 45.23F , Name = "Sofía", Surnames = "Ruiz",Sex = false, Age = 28, RegistrationDate = new DateTime(2023, 3, 20) },
 new Client { Id = 11,Points= 32.54F, Name = "Miguel", Surnames = "López",Sex = true, Age = 60, MaritialStatus = MaritialStatus.Other, RegistrationDate = new DateTime(2020, 5, 11) },
 new Client { Id = 12,Points= 14.52F, Name = "Carmen", Surnames = "González",Sex = false, Age = 31, RegistrationDate = new DateTime(2021, 11, 16) },
 new Client { Id = 13,Points= 78.8F, Name = "Antonio", Surnames = "Santos",Sex = true, Age = 48, RegistrationDate = new DateTime(2020, 3, 7) },
 new Client { Id = 14,Points= 65.456F, Name = "Isabel", Surnames = "Ortega",Sex = false, Age = 20,MaritialStatus = MaritialStatus.Other, RegistrationDate = new DateTime(2022, 7, 31) },
 new Client { Id = 15,Points= 56, Name = "David", Surnames = "Ramírez",Sex = true,Age = 43, RegistrationDate = new DateTime(2019, 10, 25) },
 new Client { Id = 16,Points= 34.01F, Name = "Raquel", Surnames = "Pardo",Sex = false, Age = 26,MaritialStatus = MaritialStatus.Other, RegistrationDate = new DateTime(2021, 2, 14) },
 };
 private async Task DeleteItem(Client item) {
 var confirmed = await _conf.Confirmation("Are you sure?", "You want to delete the item..");
 if (confirmed) {
 dataList.Remove(item);
 await jsI.Notification("Item removed successfully.".NotificationError());
 await _grid.RefreshGrid();
 }
 }
 public class Client {
 public int Id { get; set; }
 public string? Name { get; set; }
 public bool Sex { get; set; }
 public string? Surnames { get; set; }
 public int Age { get; set; }
 public float Points { get; set; }
 public DateTime RegistrationDate { get; set; }
 public MaritialStatus MaritialStatus { get; set; }
 public string FullName => $"{Name} {Surnames}";
 }
 public enum MaritialStatus {
 Single,
 Married,
 Divorced,
 Widower,
 Other
 }
}

Supported parameters

  • TItem (object): Object to be represented in the grid.
  • Data (IList<TItem>): List of TItem objects to be represented (not required), used for static data loading.
  • ShowLoad (bool): To customize when you want the gray area to show the loading animation.
  • IconLoad (bool): Icon to display (if not set, default is astrol-spin1 ).
  • Pageable (bool): If you want the grid to be pageable (default is true).
  • Selectable (bool): Specify if grid rows are selectable (default is false).
  • PageSize (int): Number of items per page (default is 10).
  • OnSelected (EventCallback<List<TItem>>): Event triggered if the grid is Selectable and a row is selected. Receives the list of items selected by the user.
  • NoSearchResultText (string): Text to display when no results are found (default is No se han encontrado elementos.).
  • PagePaginationText (string): Text to display for the word página in pagination (default is página.).
  • OfPaginationText (string): Text to display for the word de in pagination (default is de.).
  • PageSizePaginationText (string): Text to display for the words Tamaño de página in pagination (default is Tamaño de página.).
  • ItemPaginationText (string): Text to display for the word elementos in pagination (default is elementos.).
  • AllPaginationText (string): Text to display for the word Todos in pagination (default is Todos.).
  • PageSizeList (List<int>): List to set the number of items that the user can request per page (default is { 5, 10, 20, 50, 100, int.MaxValue }).
  • Columns (RenderFragment): Space to represent the columns (<Column />) of the grid.
    • Name (string): Name of the property to be represented
    • Title (string): Text to display in the column header
    • Width (string): Width of the column
    • Sortable (bool): If the column should be sortable
    • Filtrable (bool): If the column should have a filter
    • FilterPlaceholder (string): placeholder text to display in the filter
    • TypeOf (Type): allows you to define the filter component according to the data type, for example typeof(DateOnly)
    • ClassHead (string): CSS class to customize the style of the header of the corresponding column in the grid
    • ClassRow (string): CSS class to customize the style of the cell corresponding to the column in the grid
    • DefaultValue (object): Allows setting a default value for the column filter
  • Options (RenderFragment): Space to define the options you want the grid to have.
  • ReadItems (EventCallback<GridResponse<TItem>>): Event that allows obtaining the current state of the Grid configuration through the AstrolPaginatedResponse<TItem> entity, allowing for a custom load to your API (not required).
    • GridResponse<TItem> (object):
      • Page (int): Current page
      • PageSize (int): Number of items per page
      • SortInfo

2. Demo AstrolGrid seleccionable con opciones

Note
In this example, data loading from the server is simulated, and it is selectable by rows. Column data filtering has been disabled.
Id
Full name
Points
Maritial status
Sex
Age
Date
1
Juan Pérez
34.56
Widower
True
25
1/1/2022 12:00:00 AM
2
María García
23.14
Married
False
32
3/15/2021 12:00:00 AM
3
Pedro Rodríguez
36.32
Single
True
45
6/30/2020 12:00:00 AM
4
Laura Fernández
56.09
Divorced
False
19
2/28/2022 12:00:00 AM
5
Carlos Sánchez
12.05
Married
True
56
12/1/2019 12:00:00 AM
página de 4
© 2025 AstrolUI v8.0.4
Se ha producido un error no controlado. Recargar 🗙