OroCRM Forums

Covering OroCRM topics, including community updates and company announcements.

Forums Forums OroCRM OroCRM – How do I? Questions Show/Hide icon in datagrid

This topic contains 9 replies, has 4 voices, and was last updated by  prganvani 7 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
  • #28735

    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
  • #28736

    Yevhen Shyshkin
    Participant

    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.

    #28737

    mike_m
    Participant

    Thanks for helping me out. It works perfectly.

    #28738

    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.

    #28739

    Yevhen Shyshkin
    Participant

    Hello.

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

    #28740

    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.

    #28741

    Yevhen Shyshkin
    Participant

    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.

    #28742

    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.

    #28743

    Yevhen Shyshkin
    Participant

    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.

    #28744

    prganvani
    Participant

    How to Remove GridSetting button from datagrid view?

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

The forum ‘OroCRM – How do I? Questions’ is closed to new topics and replies.

Back to top