OroPlatform Forums

Covering OroPlatform topics, including community updates and company announcements.

Forums Forums OroPlatform OroPlatform – Programming Questions Grid delete is not working

This topic contains 6 replies, has 3 voices, and was last updated by  cardiac 8 years, 1 month ago.

Starting from March 1, 2020 the forum has been switched to the read-only mode. Please head to StackOverflow for support.

  • Creator
    Topic
  • #34060

    cardiac
    Participant

    Hi,

    adding another grid, I am facing another issue:
    I added the more or less default behavior of a delete action to the datagrid.

    When I click on the delete action button, the dialog shows up and when clicking ok the element is deleted in the UI. But after the reload the element is present again.

    So I checked the networking and the delete request won’t be fired. I checked the delete-action.js and checked the URL for the request and it seems to be okay.

    Where to debug next? Why is the delete request missing?

    Best regards

Viewing 6 replies - 1 through 6 (of 6 total)
  • Author
    Replies
  • #34061

    Rodolfo
    Participant

    Hi @cardiac

    1) I would verify if the route exists on your application. If not, double check your routing annotations or yml.

    php app/console debug:route | grep app_api_delete_customerprojectarticle

    2) I would figure out why don’t have ACL parameter for delete action

    3) Since using the browser inspector you don’t see any network request to delete route, I would double check if cleaning cache command are generating the new .js route files.

    4) Also I would add a breakpoint on delete controller action

    #34062

    cardiac
    Participant

    Hi Rodolfo,

    that’s things I checked before, but here are the results:

    1)

    2) I wanted to figure out if ACL is the problem
    Adding (or removing) ACL app_customerprojectarticle_delete makes no difference.

    3) The first thing I do having problems with Oro is a complete platform update.

    3) The delete controller action is not triggered at all. But sure, I added a breakpoint there and see no change

    #34063

    Yevhen Shyshkin
    Participant

    Hello, cardiac.

    If request isn’t triggered from the frontend part – then this is JS issue. Please, check if DeleteAction::doDelete action in delete-action.js really triggers request via model.destroy, and if not – why it happens.

    #34064

    cardiac
    Participant

    I tried to debug the whole thing:

    Logging ModelAction.getLink(): /api/rest/latest/customerprojectarticles/2

    DeleteAction::doDelete is triggered: console.log("Success"); in delete-action.js Line 53, but console.log(this); returns undefined here.

    Logging console.log(this.model); in line 44 of DeleteAction::doDelete:

    I bet there is a check somewhere in the JS parts where it relies on a column named id which doesn’t exist.

    #34065

    Yevhen Shyshkin
    Participant

    > I bet there is a check somewhere in the JS parts where it relies on a column named id which doesn’t exist.
    Look’s like you are right, and I think I found an issue – Backbone checks for identifier field (“id” by default) to find out if model is new, and if it’s not – delete will not be triggered.

    That’s our issue, thank you very much for reporting – we need to fix it ASAP. For now you should specify identifier alias called “id” and pass it as a property.

    #34066

    cardiac
    Participant

    Thanks Yevhen

    I renamed the “caId” to “id” as the alias, and it’s working.

Viewing 6 replies - 1 through 6 (of 6 total)

The forum ‘OroPlatform – Programming Questions’ is closed to new topics and replies.

Back to top