Here is a visual example:
In one window there are shown multiple items from one entity.
The entity has attachments so for each item we display the
attachment-grid through the
Surprisingly (for me) this kind of works in that for each item there is an attachment grid rendered. The only issue is that the data displayed in all the grids is the data of the first grid.
So for my case I overwrite the datagrid-component.js and compose the cache key with the widget id.
Even though I'm not sure that this is an important issue with the datagrid (because the situation I stumbled upon is rare) I still wanted to notify you of it's existence. If you do agree with me and consider it an issue and decide that you want it resolved I can make a pull request with a fix for it.
The fix I propose is to use the grid id as a key for the cache instead of the grid name or concatenate the grid id to the grid name.
Here is a visual example:
Hi, . Thanks for your request. Please make PR, I think this is an interesting issue and if your fix is correct, we can merge it to core code.
I've answered in your pull request. Will
oro_datagrid_build_inputname twig functions help your issue?
No. The attachment widget is rendered in a complicated way and to me it seemed more difficult to pass a unique name rather than disable the caching.
Long time has passed since then so I don't remember exactly the complication but I know that I could not pass easily a custom grid name. (I just looked a little over the code to refresh my memory and it is not easy to understand how the attachment grid appears: it's coming from a placeholder which outputs a js widget which then renders the grid).
However I admit that this may not be an issue with the datagrid (and I did say it since I asked if I should do this pull request) but that is why I started this discussion. I don't mind at all if this is not an acceptable solution and this pull request will be rejected.
While we are having this discussion let me point out that when multiple grids are visible they were not in sync (even though they load from the same cached data). So if I remember correctly when I uploaded a file only one datagrid was refreshing the others were not automatically updating (I hope I'm not mistaken).
Please see DataGrid Scope and
oro_datagrid_build_fullname helper documentation. It looks like it is best solution for your case.
Hi there, in my case using datagrid scope solved the data caching problem, but what I see is that the scope seems to be ignored in the construction of the request on filter update event. So, this solution could not be considered valid for datagrid using filters.
This is a bug in scope implementation. Thank you for pointing out. We will fix it in coming release.
This morning we solved this issue by overriding 'inputValue' option in the renderGrid macro with:
inputName: oro_datagrid_build_inputname(datagrid.name) ~ (datagrid.scope | length > 0 ? ':' ~ datagrid.scope : '')
The issue is fixed in master branch.