I have several autocompletes, textboxes and comboxes inside the grid.
In the autocomplete and combo box, I need to update other columns in the grid based on that value. So i have events for value changed. When I first load the grid and change the value in the autocomplete and click off into another column that is not read only it will not trigger the update/cancel to enable. I can select a value in itemID autocomplete then click into location address and select a value and still it doesn't update. I noticed that until i click on something that is "read only" column which is not editable, then it triggers. I also have cellselecthandler that will enable the cell for edit upon clicking instead of double clicking. My question is how can I modify my code/get this to work with these requirements. I need to enable the update/cancel as soon as the value is changed but it doesn't seem to trigger it for this scenario. Thanks. Video attached.
await GridInstance.EditCell(CurrentEditRowIndex, fields[CurrentEditCellIndex]);
public void FilterItemIDValueChange(ChangeEventArgs<string, FDIItemID> args)
{
if (comboboxItemID.Value != null)
{
//string itemIDLookup = selectedRows.First().itemid;
var findItemID = ItemIDs.Find(x => x.itemid == args.Value);
double curRowIndex = CurrentEditRowIndex;
// chemOrderLines[Convert.ToInt32(CurrentEditRowIndex)].NameAlias = findItemID.NameAlias;
if (findItemID != null)
{
args.ItemData.NameAlias = findItemID.NameAlias;
GridInstance.UpdateCell(curRowIndex, "NameAlias", findItemID.NameAlias);
GridInstance.UpdateCell(curRowIndex, "itemid", args.Value);
}
else
{
GridInstance.UpdateCell(curRowIndex, "NameAlias", "");
GridInstance.UpdateCell(curRowIndex, "itemid", "");
}
}
}
public async Task onFilteringItemID(Syncfusion.Blazor.DropDowns.FilteringEventArgs args)
{
args.PreventDefaultAction = true;
var pre = new WhereFilter();
var predicate = new List<WhereFilter>
();
predicate.Add(new WhereFilter() { Condition = "or", Field = "itemid", value = args.Text, Operator = "contains", IgnoreAccent = true, IgnoreCase = true });
predicate.Add(new WhereFilter() { Condition = "or", Field = "NameAlias", value = args.Text, Operator = "contains", IgnoreAccent = true, IgnoreCase = true });
pre = WhereFilter.Or(predicate);
itemQuery = args.Text == "" ? new Query().Take(25) : new Query().Where(pre).Take(25);
await this.comboboxItemID.Filter(ItemIDs, itemQuery);
}
public async void OnLocationAddressChanged(ChangeEventArgs<string, FDILocationAddress> args)
{
if (autoLocationAddress.Value != null)
{
var cords = await dataAccessService.GetLatLongByDeliveryLocation(args.Value);
GridInstance.UpdateCell(CurrentEditRowIndex, "LogisticsAddressLatitude", cords.LogisticsAddressLatitude);
GridInstance.UpdateCell(CurrentEditRowIndex, "LogisticsAddressLongitude", cords.LogisticsAddressLongitude);
GridInstance.UpdateCell(CurrentEditRowIndex, "FSDeliveryLocationId", args.Value);
}
else
{
GridInstance.UpdateCell(CurrentEditRowIndex, "LogisticsAddressLatitude", "");
GridInstance.UpdateCell(CurrentEditRowIndex, "LogisticsAddressLongitude", "");
GridInstance.UpdateCell(CurrentEditRowIndex, "FSDeliveryLocationId", "");
}
}
public async Task onFilteringLocation(Syncfusion.Blazor.DropDowns.FilteringEventArgs args)
{
try
{
if (args.Text != "")
{
string locationAddress = Constants.locationAddress + args.Text;
locationAddresses = await HttpClient.GetJsonAsync<List<FDILocationAddress>>(locationAddress);
}
await this.autoLocationAddress.Filter(locationAddresses, new Query());
}
catch (Exception e)
{
}
}
<GridColumn FilterSettings="@(new FilterSettings { Operator = Syncfusion.Blazor.Operator.Contains })" Field=@nameof(FDIChemicalOrderLine.FSDeliveryLocationId) HeaderText="Delivery Location" TextAlign="TextAlign.Right" Width="200">
<EditTemplate>
<SfAutoComplete @ref="autoLocationAddress" ID="FSDeliveryLocationId" TValue="string" TItem="FDILocationAddress" @bind-Value="(context as FDIChemicalOrderLine).FSDeliveryLocationId" Placeholder="e.g. 02-36-001-13W2" CssClass="e-multi-column" DataSource="@locationAddresses" AllowFiltering="true" PopupWidth="400px" AllowCustom="false">
<AutoCompleteFieldSettings Text="FSDeliveryLocationId" Value="FSDeliveryLocationId"></AutoCompleteFieldSettings>
<AutoCompleteTemplates TItem="FDILocationAddress">
<HeaderTemplate>
<table><tr><th class="e-text-center">Address</th></tr></table>
</HeaderTemplate>
<ItemTemplate Context="context2">
<table><tbody><tr><td class="e-text-center">@((context2 as FDILocationAddress).FSDeliveryLocationId)</td></tr> </tbody></table>
</ItemTemplate>
</AutoCompleteTemplates>
<AutoCompleteEvents TValue="string" TItem="FDILocationAddress" Filtering="onFilteringLocation" ValueChange="OnLocationAddressChanged"></AutoCompleteEvents>
</SfAutoComplete>
</EditTemplate>
</GridColumn>
Attachment:
ToolBarDisabled_51f7c012.zip