Forums

Covering OroCommerce, OroCRM, OroPlatform topics, including community updates and company announcements.

Forums OroCRM OroCRM – Programming Questions Grid rowSelection refresh

This topic contains 9 replies, has 3 voices, and was last updated by  akhristiansen 1 year, 3 months ago.

  • Creator
    Topic
  • #25412

    zhex900
    Participant

    Hi,

    I have a grid that select contact information. It works like contact-group-contacts-grid. I use a button to open a widget to render this grid. I can add and delete contact relationships using this grid. But the changes are not reflected in the grid if open the grid the second time. In another words, no matter what changes are made, the grid values remain the same.

    The changes are only rendered when I load the view page and press the grid button again.

Viewing 9 replies - 1 through 9 (of 9 total)
  • Author
    Replies
  • #25413

    akhristiansen
    Participant

    Hello, @zhex900! Grid is not refreshing itself. When you opened widget for whe first time, without refreshing, it will be the same. If I understood your twig template correctly, you are isnitializing grid only one time, when page is loading. Because of this, grid is changing only after refreshing page.
    So you need to implement some solution to get rendered grid from back and ( with ajax, possibly) insert it to widget

    #25414
    Mike Kudelya
    Mike Kudelya
    Participant

    Hi

    You can look at the “+ Add” button on an Account Edit page as example.

    #25415

    zhex900
    Participant

    @akhristiansen, can you kindly give me a sample code of how to render grid from the back or ajax.

    @mike, I did looked at Oro/Bundle/AccountBundle/Resources/views/Account/widget/contactsInfo.html.twig
    But I cannot make much sense of it. I don’t know how to use it. My twig can add and remove row selections. I don’t understand the datagrid.listener.CallbackListener script.

    #25416

    zhex900
    Participant

    What do you think about using this post?

    #25417

    akhristiansen
    Participant

    This past of code will refresh datagrid. I think you can execute it when button is clicked and before widget will be shown. I wanted to post something like that, but you was first :).

    #25418

    zhex900
    Participant

    This is my first time doing this. Can you please show me how to what you said? What should I put inside this?

    #25419

    akhristiansen
    Participant

    I think code must look like that
    https://gist.github.com/Nikoblood/021734aae464bc43da8f0c84d0ae08d8

    This is just example,you need to debug it and customize to your needs.

    #25420

    zhex900
    Participant

    Do I need to run php app/console oro:requirejs:build first ?

    #25421

    akhristiansen
    Participant

    No, you need to create all valid js files, change twig templates first, and only after that run this command.

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

You must be logged in to reply to this topic.

You will be redirected to [title]. Would you like to continue?

Yes No
ssossossossossosso