Hello everyone here is my issue , I created my module and my grids to display information , the grids are displaying with no issues whatsoever , but here is the thing when I try to add extension with js to my grid to make at least pagination work it doesn't ,
here is my code :
$SearchCriteria = new SearchCriteria([], 'id_product', 'DESC', 1, 2); $gridfactory = $this->get('prestashop.core.grid.visible_grid_factory'); $visiblegrid = $gridfactory->getGrid($SearchCriteria); $SearchCriteriaExtrafields = new SearchCriteria([], 'id', 'ASC', 0, 16); $gridextrafieldfactory = $this->get('prestashop.core.grid.grid_category_extrafield_factory'); $extrafieldgrid = $gridextrafieldfactory->getGrid($SearchCriteriaExtrafields); return $this->render('@Modules/stabs/views/templates/admin/form.html.twig',[ 'formtitle' => $formname, 'form' => $form->createView(), 'extragrid' => $this->presentGrid($extrafieldgrid), 'grid' => $this->presentGrid($visiblegrid), ]);
import Grid from '@PSJs/components/grid/grid'; import LinkRowActionExtension from '@PSJs/components/grid/extension/link-row-action-extension'; import SubmitRowActionExtension from '@PSJs/components/grid/extension/action/row/submit-row-action-extension'; import SortingExtension from '@PSJs/components/grid/extension/sorting-extension'; import FiltersResetExtension from '@PSJs/components/grid/extension/filters-reset-extension'; const { $ } = window $(() => { let gridDivs = document.querySelectorAll('.js-grid'); gridDivs.forEach((gridDiv) => { const grid = new Grid(gridDiv.dataset.gridId) grid.addExtension(new SortingExtension()); grid.addExtension(new LinkRowActionExtension()); grid.addExtension(new SubmitRowActionExtension()); grid.addExtension(new FiltersResetExtension()); console.log(grid); }) });
And I compiled it with webpack using an exemple from github to do it here it is : https://github.com/PrestaShop/example-modules/tree/master/demo_grid