Open mattgrul opened 3 years ago
Looks like I may have found an answer to the above here in the docs
Is there are way to trigger the grid to refresh in an external javascript component after say adding a new entity within an InsetForm?
Thanks.
This feels rather hacky and maybe not the right way however one way to achieve this would be something along the lines of:
Aware this may all change when the "Forms" feature is released if it supports inset Hyva Grids?
You could trigger an update of the grid using ajaxGridUpdate
on the Alpine view model.
Currently the method is not exposed to global scope, but maybe you could work around this by using something like
function updateGrid() {
const grid = document.querySelector('.hyva-admin-grid'); // assuming there is only one grid on the page
const viewModel = grid.__x.$data;
viewModel.ajaxGridUpdate(viewModel.filterUri);
}
Then call doUpdate()
whenever you want to reload the grid...
It for sure is hacky as heck :)
Thanks Vinai, love the idea just not comfortable with the implementation! I think I may hold of on this and revert back to the default insetListing and insetForm for now.
Is this something that will be available with the Forms work you are doing being able to inline Hyva Grids, or should it be a separate feature request for people to collab on?
Currently I'm focused on bugfixes for the grid and on finally getting the first version of forms support out the door. If you feel like it, I would appreciate a PR very much!
Hi Vinai,
More of a question than an issue.
Is there currently any documentation surrounding inserting a grid into a form? I can add the grid into the form ui component using
However when it comes to replicating the default Magento functionality of
exports
,imports
,links
andlistens
to be able to filter the inserted grid and add an insetForm for example I'm unsure if you have a way around this or not?Thanks!