kendo ui datasource make several delete calls each time

6 posts, 0 answers
  1. Alex
    Alex avatar
    3 posts
    Member since:
    Jun 2015

    Posted 04 Feb Link to this post

    when i click on delete first time i get error on delete when i click delete again i get 2 delete requests. the one i made first time and the one i made the second time. if i click the third time so i get 3 errors and so on

    link to stackoverflow question(with code):

    https://stackoverflow.com/questions/48561985/kendo-ui-datasource-make-several-delete-calls-each-time

     

     

  2. Stefan
    Admin
    Stefan avatar
    1710 posts

    Posted 06 Feb Link to this post

    Hello, Alex,

    Thank you for the details.

    Based on the screenshots there is an error on the server. This is creating a scenario, where the Grid does not receive a success on the delete operation and it tries to send in again until it is successful.

    Please debug the server the determine why the request is not successful.

    If a fully runnable example is provided I will be happy to investigate it locally and advise on how it can be resolved.

    Regards,
    Stefan
    Progress Telerik
    Try our brand new, jQuery-free Angular components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
  3. Alex
    Alex avatar
    3 posts
    Member since:
    Jun 2015

    Posted 18 Feb in reply to Stefan Link to this post

    hi stefan     

    the server return error becouse we did operation that we should get an error. (so its not bug on the server side).

    i want get error from the server. 

    but what i need to do so in the next call only the relevant api call will be triggered?

    i mean that we have some entity that we want to delete and based on the logic in the server we cant delete it and the server return error.

    so how can we make the datasource to send only the relevant request and not all the requests?

    for me the error from the server is what i want to get, but i need the datasource will see it as "success" and not error so it will not send this request again.

    if its not clear i will try to make code sample

    thanks,

    alex

     

  4. Stefan
    Admin
    Stefan avatar
    1710 posts

    Posted 20 Feb Link to this post

    Hello, Alex,

    Yes, it will be helpful to provide some example or more details.

    In general, the Grid is designed to delete, update or create records only when the server return success. Returning an error and still deleting the records will collide with the standard practices when handling CRUD operations with a server and a database.

    Please advise a scenario, when the server should return an error but the record should be removed anyway?

    I will be expecting more details and gladly assist.

    Regards,
    Stefan
    Progress Telerik
    Try our brand new, jQuery-free Angular components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
  5. Alex
    Alex avatar
    3 posts
    Member since:
    Jun 2015

    Posted 20 Feb in reply to Stefan Link to this post

    hi stefan     

    when the server return error im not deleting the row. we delete the row only on success.

    but the problem is that next time i will try to delete any row and get error from the server so it will send all the requests that returned error.

    and we want only 1 request will be sent to the server .

    in the screenshot of the error you can see that.

    for example im trying to delete row with id=1.

    i got error and not deleted the row.

    now im trying to delete row with id=2.

    what happens now is when i try delete id=2 the datasource send delete request of id=1 + id=2.

    what i want is to send only the request of the specific row im trying to delete.

    it will take me some time to provide code example so if its not clear i will work on it.

    Thanks

    Alex

     

     

  6. Stefan
    Admin
    Stefan avatar
    1710 posts

    Posted 22 Feb Link to this post

    Hello, Alex,

    Thank you for the clarification.

    This will automatically happen if in the first unsuccessful request a model error is returned.

    I made a video showing that if the server returns a model error the Grid will send only the second records to the server:

    https://www.screencast.com/t/q9qcfJsP8

    I made a simple check on the server to add a model error on the items with ID 1 and 2:

    if (products.Any())
                {
                    foreach (var product in products)
                    {
                        productService.Destroy(product);
                        if(product.ProductID == 1 || product.ProductID == 2)
                        {
                            ModelState.AddModelError("cannot delete", "test");
                        }
                    }
                }

    I will be expecting the example as I cam assume that the result from the first request is not expected.

    Please also check the CRUD operation article with can prove helpful:

    https://docs.telerik.com/kendo-ui/framework/datasource/crud

    Regards,
    Stefan
    Progress Telerik
    Try our brand new, jQuery-free Angular components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
Back to Top