Update/Cancel buttons not triggered when updating scenario

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

5 Replies 1 reply marked as answer

CJ chris johansson November 25, 2020 04:43 PM UTC

I noticed its basically because of the ValueChange function, doing grid.updatecell causes this...
But I need to update other columns based no this value and then trigger the update/cancel to enable.


RS Renjith Singh Rajendran Syncfusion Team November 26, 2020 04:07 AM UTC

Hi Chris, 

Greetings from Syncfusion support. 

We suggest you to call the PreventRender(false) method of Grid in the Created event handler of the SfAutoComplete components you have rendered in EditTemplate to overcome the problem you are facing.  

Please refer and use the below highlighted codes in your application to overcome the reported problem. 

 
<GridColumn ... Field=@nameof(Order.FSDeliveryLocationId) HeaderText="Delivery Location" TextAlign="TextAlign.Right" Width="200"> 
    <EditTemplate> 
        <SfAutoComplete @ref="autoLocationAddress" ...> 
            ... 
            <AutoCompleteEvents Created="Created" TValue="string" TItem="FDILocationAddress" ...></AutoCompleteEvents> 
        </SfAutoComplete> 
    </EditTemplate> 
</GridColumn> 

public void Created(){    GridInstance.PreventRender(false);}

Please get back to us if you need further assistance. 

Regards, 
Renjith Singh Rajendran 


Marked as answer

CJ chris johansson November 26, 2020 04:44 PM UTC

Hello, although that seemed to trigger the update/cancel.
The issue is that the filtering doesn't work as expected anymore.. Once I click in the cell and  start to backspace and results show up, the original text comes back and doesn't filter properly as I do that.. You can see in the video... 

  private async Task OnServiceFilter(FilteringEventArgs args)
    {

        try
        {

            if (args.Text != "")
            {

                string GetServiceLocationAndLicenseID = Constants.GetServiceLocationAndLicenseID + args.Text;

                fDIServiceLocations = await HttpClient.GetJsonAsync<List<FDIServiceLocation>>(GetServiceLocationAndLicenseID);


            }
            await this.autoServiceLocation.Filter(fDIServiceLocations, new Query());

        }
        catch (Exception e)
        {

        }
    }

Attachment: FilterIssue_7425c782.zip


CJ chris johansson November 26, 2020 04:52 PM UTC

Also I noticed that if I add GridInstance.PreventRender(true);
in the filtering method, then it works.. along with using that created function with GridInstance.PreventRender(true);
Not sure if this is the correct way to do things but I think it works...


RS Renjith Singh Rajendran Syncfusion Team November 27, 2020 12:57 PM UTC

Hi Chris, 

Thanks for your update. 

Query : Also I noticed that if I add GridInstance.PreventRender(true); in the filtering method, then it works.. Not sure if this is the correct way to do things but I think it works... 

We could see that you have resolved the reported problem. Yes, you can use this way to overcome the reported behavior.  

We would like to inform you that, we have prevented unwanted component renderings to improve Grid performance. This PreventRender allows you to have control over grid component rendering. Please refer the below documentation for more details regarding this topic, 

Please get back to us if you need further assistance. 

Regards, 
Renjith Singh Rajendran 


Loader.
Up arrow icon