Hi Soren,
Thanks for contacting Syncfusion support.
Query1: “he same for the next column, but the grid does not recognise the new values set manually”
We have analyzed your query and we are able to reproduce the reported issue at our end also. We have modified your code example to resolve the reported issue. We have used OnCellSave event of the Grid to update the dropdown column value. Similarly in ValueChange event we have used PreventRender() method of Grid update the toolbar properly.
Refer the below code example.
| <GridColumn Field=@nameof(ProductData.Product) HeaderText="Product" EditType="EditType.DropDownEdit" TextAlign="TextAlign.Left" Width="@DefaultWidth" FilterSettings="@(new FilterSettings{ Operator = Operator.Contains })"> <HeaderTemplate> Product <span class="e-search-icon e-icons" @onclick="ToggleGridSearchBar"></span> <span class="@searchorderIcon" @onclick="@(() => ChangeSortOrder("Grid", "Product"))"></span> </HeaderTemplate> <EditTemplate> <SfDropDownList ID="Product" @ref="Dropproduct" Placeholder="Select a Product" TItem="string" TValue="string" @bind-Value="@((context as ProductData).Product)" DataSource="@ProductDistinct" AllowFiltering="true"> <DropDownListEvents TValue="string" TItem="string" ValueChange="@((args)=>ValueChange(args,context as ProductData))"></DropDownListEvents> </SfDropDownList> </EditTemplate> </GridColumn>
public void OnCellSave(CellSaveArgs<ProductData> Args, string grid){ if(Args.ColumnName == "Product") { Args.Value = Dropproduct.Value; // update the value for the Product column here. }}
public async Task ValueChange(@Syncfusion.Blazor.DropDowns.ChangeEventArgs<string, string> args , ProductData rowData){ if(args.Value is not null) { string newSupplier = SupplierDistinct.Where(m => m.Product == args.Value).Select(m => m.Supplier).FirstOrDefault(); double index = await Grid.GetRowIndexByPrimaryKey(rowData.ProductKey); //update the supplier column here await Grid.UpdateCell(index, "Supplier", newSupplier); // Grid.PreventRender(false); }}
|
Kindly download the modified code example from below
Refer our UG documentation for your reference
Query2: “ut when I attach a new textbox to the filter component, it does not correspond with data.”
We have analyzed your query and we are able to reproduce the reported behavior at our end. While using EditTemplate, we need to handle the filter operation externally using FilterByColumn method. We have used Input event of TextBox component.
Refer the below code example
|
<GridColumn Field=@nameof(ProductData.Supplier) HeaderText="Supplier" AllowEditing="false" TextAlign="TextAlign.Left" Width="@DefaultWidth">
<HeaderTemplate>
Supplier
<span class="e-search-icon e-icons" @onclick="ToggleGridSearchBar"></span>
<span class="@searchorderIcon" @onclick="@(() => ChangeSortOrder("Grid", "Supplier"))"></span>
</HeaderTemplate>
<FilterTemplate>
<SfTextBox Placeholder="Search.." Input="OnEnter" />
</FilterTemplate>
</GridColumn> public void OnEnter(InputEventArgs args) { Grid.FilterByColumn("Supplier","contains",args.Value); }
|
Refer our API documentation for your reference
Please get back to us if you have further queries.
Regards,
Vignesh Natarajan