Problems with server-actions in place editor.

Hi, I tried to implement SfinPlace-editor with SaveUrl.

I have followed the following documentation, https://blazor.syncfusion.com/documentation/in-place-editor/server-actions/#server-actions,
but I can't even send the request to my server.

I can modify the name locally but it doesn't send any change request to my server.

page.razor
                            <SfInPlaceEditor PrimaryKey="IdPaciente" Name="Nombre" SaveUrl="http://localhost:5011/odata/PacienteView"                                         Adaptor="Adaptors.ODataV4Adaptor" EditableOn="EditableType.EditIconClick" @bind-Value="@Paciente.Nombre" TValue="string">
                                <EditorComponent>
                                    <SfTextBox @bind-Value="@Paciente.Nombre" Placeholder="aqui va el nombre"></SfTextBox>
                                </EditorComponent>
                                <InPlaceEditorEvents OnActionSuccess="@OnSuccess" TValue="string"></InPlaceEditorEvents>
                            </SfInPlaceEditor>
Model view
    public class PacienteView
    {
        public int IdPaciente { get; set; }
        
        public string Nombre { get; set; }
    }
page.razor.cs
        public PacienteView Paciente = new PacienteView();

        protected override async Task OnInitializedAsync()
        {
            Paciente = await ExPacienteViewRepo.searchPaciente(Id);
        }
        public void OnSuccess(ActionEventArgs<string> args)
        {
            Console.WriteLine("Event is triggered");
        }

Debugg
     The first time I run the code
     
     all the others
     
     no action in network
     

If you could get a tangible example of this or tell me what is wrong.
Thanks for your attention and blessings

4 Replies

RK Revanth Krishnan Syncfusion Team March 2, 2021 02:34 PM UTC

Hi Carlos, 
 
 
Greetings from Syncfusion support. 
 
 
We are currently validating the query as a high priority we will update you with further details on or before 4th March. We appreciate your patience till then. 
 
Meanwhile, can you please share us with the code snippet of the server-side action when the In-place editor value is submitted? This will be helpful for us to validate and reproduce the issue and assist you at the earliest. 
 
Regards, 
Revanth 



CA Carlos March 3, 2021 05:14 PM UTC

Tank you for your prompt reply. This controller works fine for me on SfGrid.

This is my controller. 
public class PacienteViewController : ODataController
    {
        private readonly saeeContext db;
        private readonly IMapper _mapper;

        public PacienteViewController(saeeContext context, IMapper mapper)
        {
            db = context;
            _mapper = mapper;
        }

        [AcceptVerbs("GET")]
        public async Task<IQueryable<PacienteView>> Get(ODataQueryOptions opts)
        {
                if (User.IsInRole("Administradores"))
                {
                    var pacienteList = await db.Pacientes.ToListAsync();
                    var result = _mapper.Map<IEnumerable<PacienteView>>(pacienteList);
                    var query = result.AsQueryable();
                    if (opts.OrderBy != null)
                        query = opts.OrderBy.ApplyTo(query);

                    var request = opts.Request.Query;
                    string search = request["$search"];
                    if (!string.IsNullOrWhiteSpace(search))
                    {
                        string lastWord = search.Split("OR ").Last();
                        Int32.TryParse(lastWord, out int j);
                        query = query.Where(x => ((x.Nombre + " " + x.Apellido).Contains(lastWord, StringComparison.OrdinalIgnoreCase)) || x.IdPaciente==j);
                    }
                    return query;
                }
            return null;
        }

        // POST: odata/EventDatas
        [AcceptVerbs("POST", "OPTIONS")]
        public void Post([FromBody]PacienteView newPaciente)
        {
                if (User.IsInRole("Administradores"))
                {
                    var result = _mapper.Map<Paciente>(newPaciente);
                    db.Pacientes.Add(result);
                    db.SaveChanges();
                }
        }

        [AcceptVerbs("PATCH", "MERGE", "OPTIONS")]
        public void Patch(int key,[FromBody]Delta<PacienteView> patchPaciente)
        {
            if (User.IsInRole("Administradores"))
            {
                    var personDatabase = db.Pacientes.Find(key);
                    var personDTO = _mapper.Map<PacienteView>(personDatabase);
                    patchPaciente.Patch(personDTO);
                    _mapper.Map(personDTO, personDatabase);
                    db.Update(personDatabase);
                    db.SaveChanges();
                }
            }
            return null:
        }
    }
}

I also add my grid datamanger that works well
            <SfDataManager Url="http://localhost:5011/odata/PacienteView" Adaptor="Adaptors.ODataV4Adaptor"></SfDataManager>

Again thank you very much for your reply, I hope you can help me.


RK Revanth Krishnan Syncfusion Team March 4, 2021 02:33 PM UTC

Hi Carlos, 
 
 
Good day to you. 
 
 
We have further validated your query and have considered “OnActionSuccess event arguments not returning data values properly after first time” as a bug from our end and logged the report for the same and the fix will be included in our 2021 Volume 1 release.  
    
You can now track the current status of the report, review the proposed resolution timeline, and contact us for any further inquiries through this link:  
 
Regards, 
Revanth 



RK Revanth Krishnan Syncfusion Team April 1, 2021 03:43 AM UTC

Hi Carlos, 
 
 
Thanks for the patience. 
 
 
We have resolved the reported issue OnActionSuccess event arguments not returning data values properly after first time with the package version 18.4.48.   
Can you please upgrade your package to this version to resolve the issue on your end?   
   
 
Regards, 
Revanth 


Loader.
Up arrow icon