<CustomGridAddEditDel @ref="customGrid" ID="testCust" TValue="UserReturnView" AllowSorting="true" AllowFiltering="true" AllowPaging="true" Toolbar="@(new List<string>() { "Add", "Edit", "Delete" })">
<SfDataManager AdaptorInstance="typeof(UserAdmAdaptor)" Adaptor="Adaptors.CustomAdaptor"></SfDataManager>
<GridFilterSettings Mode="FilterBarMode.Immediate" ShowFilterBarStatus="false" />
<GridPageSettings PageSizes="true"></GridPageSettings>
<GridEvents OnActionComplete="ActionCompleteCallback" DataBound="DataHandler" OnActionFailure="FailureCallback" OnActionBegin="ActionBegin" TValue="UserReturnView"></GridEvents>
<GridEditSettings AllowEditing="true" AllowDeleting="true" AllowAdding="true" Mode="@EditMode.Dialog">
<Validator>
<DataAnnotationsValidator></DataAnnotationsValidator>
</Validator>
<HeaderTemplate>
@{
var user = context as UserReturnView;
if (user.UserId > 0)
{
<span>Edit</span>
}
else
{
<span>Add</span>
}
}
</HeaderTemplate>
<Template>
@{
var user = context as UserReturnView;
<div>
<div class="row">
<div class="col-md-6">
<label class="form-label">First name</label>
<SfTextBox ID="FirstName" @bind-Value="@(user.FirstName)" Placeholder="First name"></SfTextBox>
<ValidationMessage For="(()=>user.FirstName)" />
</div>
<div class="col-md-6">
<label class="form-label">Last name</label>
<SfTextBox ID="LastName" Placeholder="Last name" @bind-Value="@(user.LastName)"></SfTextBox>
<ValidationMessage For="(()=>user.LastName)" />
</div>
</div>
<div class="row">
<div class="col-md-6">
<label class="form-label">Role</label>
<SfDropDownList ID="EditRole" TValue="int" @bind-Value="@(user.RoleId)" TItem="Role" Placeholder="Select a role" ShowClearButton="true">
<SfDataManager AdaptorInstance="typeof(UserRoleAdmAdapter)" Adaptor="Adaptors.CustomAdaptor"></SfDataManager>
<DropDownListFieldSettings Text="@nameof(Role.Name)" Value="@nameof(Role.RoleId)" />
</SfDropDownList>
<ValidationMessage For="(()=>user.RoleId)" />
</div>
<div class="col-md-6">
<label class="form-label">Email Address</label>
<SfTextBox ID="Email address" @bind-Value="@(user.EmailAddress)" Type="InputType.Email" Placeholder="Email address"></SfTextBox>
<ValidationMessage For="(()=>user.EmailAddress)" />
</div>
</div>
<div class="row">
<div class="col-md-6">
<label class="form-label">Password</label>
<SfTextBox ID="Password" @bind-Value="@user.Password" Enabled="IsAdd" Type="InputType.Password" Placeholder="Password"></SfTextBox>
<ValidationMessage For="(()=>user.Password)" />
</div>
<div class="col-md-6">
<label class="form-label">Password comfirm</label>
<SfTextBox ID="Password confirm" @bind-Value="@user.PasswordConfirm" Type="InputType.Password" Enabled="IsAdd" Placeholder="Password confirm"></SfTextBox>
<ValidationMessage For="(()=>user.PasswordConfirm)" />
</div>
</div>
</div>
}
</Template>
</GridEditSettings>
<GridColumns>
<GridColumn Field=@nameof(UserReturnView.UserId) IsPrimaryKey="true" IsIdentity="true" Visible="false" />
<GridColumn Field=@nameof(UserReturnView.FirstName) HeaderText="First Name" Width="150"></GridColumn>
<GridColumn Field=@nameof(UserReturnView.LastName) HeaderText="Last Name" Width="150"></GridColumn>
<GridColumn Field=@nameof(UserReturnView.RoleName) HeaderText="Role Name" Width="150">
<FilterTemplate>
<SfDropDownList ID="filterRole2" TValue="int" TItem="Role" Placeholder="Select a role" ShowClearButton="true">
<SfDataManager AdaptorInstance="typeof(UserRoleAdmAdapter)" Adaptor="Adaptors.CustomAdaptor"></SfDataManager>
<DropDownListFieldSettings Text="@nameof(Role.Name)" Value="@nameof(Role.RoleId)" />
<DropDownListEvents TItem="Role" TValue="int" ValueChange="@CustomGridValueChangeHandler" />
</SfDropDownList>
</FilterTemplate>
</GridColumn>
<GridColumn Field=@nameof(UserReturnView.EmailAddress) HeaderText="Email address" Width="150"></GridColumn>
</GridColumns>
</CustomGridAddEditDel>
CustomGridAddEditDel
@typeparam TValue
@inherits SfGrid<TValue>
<RemoveDialog @ref="@removeDialog" TypeGrid="TValue" Grid="@this"></RemoveDialog>
<SfGrid TValue="TValue" ID="gridCust" AllowSorting="true" AllowFiltering="true" AllowPaging="true" Toolbar="@(new List<string>() { "Add", "Edit", "Delete" })" @attributes="props">
@*<GridPageSettings PageCount="@PAGE_COUNT" PageSize="@DEFAULT_PAGE_SIZE" PageSizes="@PageSizes"></GridPageSettings>
<GridFilterSettings Mode="FilterBarMode.Immediate" ShowFilterBarStatus="false" />*@
@ChildContent
</SfGrid>
at Syncfusion.Blazor.Grids.Internal.Filter`1.<FilterByColumn>d__86.MoveNext()
at Syncfusion.Blazor.Grids.SfGrid`1.<FilterByColumnAsync>d__1061.MoveNext()
at Northwind.Interface.Server.Pages.SfUsersAdmModel.<CustomGridValueChangeHandler>d__9.MoveNext() in F:\PresentationProjectNorthwind\Northwind.Interface.Server\Pages\SfUsersAdmModel.cs:line 25
Hi Kavit,
Greetings from Syncfusion support.
Based on your update, we suspect that you’re facing issue in filtering records in column. So, we created simple level custom component sample for filtering. But we’re unable to face any issue while filtering. So, Before proceeding further Kindly share the following details to us.
Above request details will be very helpful for us to validate the reported query at our end and provide solution as easy as possible.
Regards,
Sarveswaran PK
made an error example. In the first column of the lower grid there is a drop down list, when you select, you get an error.
can you help with a solution?
Hi Kavit,
Sorry for the delay,
Based on your query, we suspect that you want to filter records using dropdown on Custom component sample. Kindly refer the shared code snippet and attached sample modified sample for your reference.
CustomGrid.razor.cs { SfGrid<TValue> Grid1;
public async Task CustomFilter(string val) { await Grid1.FilterByColumnAsync("CustomerID", "equal", val); } }
Index.razor
private async void ValueChangeHandler(ChangeEventArgs<string, Customer> obj) { await grid.CustomFilter(obj.Value); } |
Regards,
Sarveswaran PK
Thanks for the solution.
If I Add
<GridEditSettings>
</GridEditSettings>
to Custom grid, not working even add, edit, del in customAdapter class.
Understood. It was necessary to specify in the id of the menu elements, the id of the table from html.
Hi Kavit,