ssossossosso

Forums

Covering OroCRM topics, including community updates and company announcements.  Subscribe

This topic contains 9 replies, has 4 voices, and was last updated by prganvani prganvani 6 months, 1 week ago.

  • Creator
    Topic
  • #16252

    mike_m
    Participant

    I have defined a datagrid for activity items. The activity can have the status open or closed. If the activity status is open than 2 icons (view, edit) should be shown, but if the status is closed than only the view icon should be shown. Closed activity can not be edited.

    How can I implement this requirement?

    pseudo code:

    Thanks for helping

Viewing 9 replies - 1 through 9 (of 9 total)
  • Author
    Replies
  • #16272
    Yevhen Shyshkin
    Yevhen Shyshkin
    Oro Core

    Hello, mike_m.

    You have to use action configuration (or action permission provider) – this way you can enable/disable actions on a row level. See this example and this code.

    #16276

    mike_m
    Participant

    Thanks for helping me out. It works perfectly.

    #21453
    adriwan_kenoby
    adriwan_kenoby
    Participant

    Hi @Yevhen Shyshkin,

    I use this in a project.
    It works fine for one action but I use the same logic for another and it doesn’t works. I have a weird twig runtime error “type must be defined” instead… Type of what ? The action, I thought it was defined…

    The problem maybe is that I use same link for both action. I just want to toggle the state (a bool) of my entity ans display different icon for the action depend on this state.

    #21474
    Yevhen Shyshkin
    Yevhen Shyshkin
    Oro Core

    Hello.

    Please, see how it was done for processes or workflows grid – here is grid configuration and permission provider.

    #21517
    adriwan_kenoby
    adriwan_kenoby
    Participant

    Hello,

    I have already seen this example and I have a weird excpetion “type must be defined”. My use case isn’t exactly like this example because I have only one methode activateAction which toggle the state of my entity.

    Look at the previous code. I have made like in your example…

    I’am not sure but I suppose that the problem happen because I put this action in a RestController and not in FOSRestController. It maybe annotations which are not correctly defined.

    Thanks for your help.

    #21545
    Yevhen Shyshkin
    Yevhen Shyshkin
    Oro Core

    I think you are seeing this exception – it is triggered if action configuration doesn’t include action type. Please, check content of the configuration that triggers this exception – it might give you some clues.

    #21553
    adriwan_kenoby
    adriwan_kenoby
    Participant

    Hi,

    Sorry but I don’t really understand how to check the configuration.
    I thought the action type was define in datagrid.yml. Morevover it work fine for another action that I have define, then I don’t understand why this not work for this one.

    #21557
    Yevhen Shyshkin
    Yevhen Shyshkin
    Oro Core

    There are a lot of things that might trigger this exception – e.g. incorrect file formatting, other grid with invalid configuration at the same page, some listener that modifies your config etc. So, i’m asking you to debug this case and check what configuration really triggers this error.

    #32928
    prganvani
    prganvani
    Participant

    How to Remove GridSetting button from datagrid view?

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

You must be logged in to reply to this topic.