OroPlatform Forums

Covering OroPlatform topics, including community updates and company announcements.

Forums Forums OroPlatform OroPlatform – Programming Questions Custom datagrid action

This topic contains 22 replies, has 3 voices, and was last updated by  Mike Kudelya 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
  • #34192

    adriwan_kenoby
    Participant

    Hi,

    I work on a project that aim to monitor website.

    So I have an entity, named Alerte, which is create or update automatically. I don’t need ( and I don’t want) a form associated, no one have to manage this entity ( create or delete) but in some case i need that a user can update just one field which contain a DateTime. So I want a button, when i click on it, it update this entity field with new DateTime but i never need a update page with form.

    I found a lot of information but none really is that i want.

    I follow this tuto : http://www.ibnab.com/en/blog/orocrm/orocrm-create-custom-grid-action-technique-and-secret

    But i found these informations too :
    https://github.com/orocrm/platform/blob/11114aa77cb972f82038592bb743c96cf7fb1c2f/src/Oro/Bundle/ActionBundle/Resources/doc/configuration-reference.md#substitution-of-action
    https://github.com/orocrm/platform/blob/master/src/Oro/Component/Action/Resources/doc/actions.md

    I think that I can do what i want with just configuring an action.

    I really need to undestand how it works.

    My code :

    But maybe something like this can be done :

    But i dont understand how it works.

    Thanks for replies.

    Adrien

Viewing 15 replies - 1 through 15 (of 22 total)
  • Author
    Replies
  • #34193

    adriwan_kenoby
    Participant

    Moreover i havent this command php app/console oro:action:configuration:validate.

    I use OroCrm v1.9

    #34194

    Mike Kudelya
    Participant

    Hi,

    Could you please tell me, what happened wrong? Do you have js error or button doesn’t appear?
    I copied your code, did some changes and all are working.

    If you have own bundle you must create extension file, to load your actions.yml:

    I changed second line on js/datagrid/action/end_alerte-action.js from

    to

    because i have own custom bundle and system won’t find model-action that is in the platform.

    Also i changed requirejs.yml to

    After javascript modifications don’t forget run

    #34195

    Mike Kudelya
    Participant

    This configuration is not necessary:

    #34196

    adriwan_kenoby
    Participant

    I always have this js error :

    abstract-widget.js?version=9fdd8639:643 Uncaught Error: Invalid server response: <!DOCTYPE html>

    I have a custom bundle and my action.yml was already loaded.

    There were a problem in my route name, it was the same that viewAction, I have changed it to /end/{id} but i have still the same error and the loading logo… When i reload the page i can see that the action was performed, the problem is the response i return, but i don’t understand the issue.

    Thanks for reply.

    #34197

    adriwan_kenoby
    Participant

    Moreover when i use the map config option in requirejs.yml then, require search the model action.js in my bundle… So i don’t use it.

    May I put my action in an API REST controller instead of a standard controller ?

    How it is implemented for the delete Action ?

    How work the handleRequest method ?

    Any chance to have help ?

    #34198

    adriwan_kenoby
    Participant

    @Mike Kudelya

    I don’t understand how it can works to you and not for me.

    #34199

    Mike Kudelya
    Participant

    Hi,

    Sorry for long waiting. I have made working example, yes, you are right about REST API controller:
    Please add:

    src/Custom/Bundle/OroBundle/Resources/config/oro/routing.yml:

    src/Custom/Bundle/OroBundle/Resources/config/oro/routing_api.yml:

    src/Custom/Bundle/OroBundle/Controller/Api/Rest/AlerteController.php:

    You needed comment this line at EndAlerteAction.php:

    Here is my action in datagrid.yml:

    #34200

    adriwan_kenoby
    Participant

    Still not working… and still the same error

    abstract-widget.js?version=9fdd8639:643 Uncaught Error: Invalid server response: [object Object]

    Maybe i need to write my custom handler but i don’t know how to do ?

    #34201

    adriwan_kenoby
    Participant

    @Mike Kudelya

    Have you got any solution please ?

    #34202

    Mike Kudelya
    Participant

    Hi,

    You must call api action and create right API response.

    Are you sure, that your action (‘link: end_alerte_link’) in datagrid.yml looks at API AlerteController::endAction ?

    Here is configuration of my link:

    #34203

    adriwan_kenoby
    Participant

    Hello Mike Kudelya,

    Here is my code, the action is performed but I always have the jsErrors mentionned previously.

    Thanks and regards.

    #34204

    Mike Kudelya
    Participant

    Hi,

    Please remove ‘frontend_handle: dialog’ and problem will be disappear.
    data_identifier, frontend_options, entity_name also is not necessary.

    #34205

    adriwan_kenoby
    Participant

    Thanks a lot for your help @Mike Kudelya,

    I could not figure myself how to do ?

    A last question if you have time to answer me. I want to add a precondition to my action, I try this

    I think my definition of the attribute end isn’t correct.

    What is the conf to do that ?

    Thanks ands regard.

    #34206

    terih
    Participant

    Hello guys
    I have a question regarding datagrid, if table header (with name of columns) can be higher so column names can be displayed on more lines. How i can change column height in datagrid and column names can be displayed on more lines???

    #34207

    Mike Kudelya
    Participant

    Hi,

    At the moment orocrm does not support pre_conditions operator in datagrid.yml

Viewing 15 replies - 1 through 15 (of 22 total)

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

Back to top