ElFamosoWilli Posted August 17, 2023 Share Posted August 17, 2023 (edited) 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 Edited August 17, 2023 by ElFamosoWilli (see edit history) Link to comment Share on other sites More sharing options...
ElFamosoWilli Posted August 17, 2023 Author Share Posted August 17, 2023 here is the rest of my code prestashop.module.stabs.tables.grid_visible_table: class: 'PrestaShop\Module\Stabs\Tables\GridVisibleTable' parent: 'prestashop.core.grid.definition.factory.abstract_grid_definition' public: true prestashop.module.stabs.tables.visible_query_builder: class: 'PrestaShop\Module\Stabs\Tables\VisibleQueryBuilder' parent: 'prestashop.core.grid.abstract_query_builder' arguments: - "@=service('prestashop.adapter.legacy.context').getContext().language.id" - "@=service('prestashop.adapter.legacy.context').getContext().shop.id" public: true prestashop.module.stabs.visible_data_factory: class: 'PrestaShop\PrestaShop\Core\Grid\Data\Factory\DoctrineGridDataFactory' arguments: - '@prestashop.module.stabs.tables.visible_query_builder' - '@prestashop.core.hook.dispatcher' - '@prestashop.core.grid.query.doctrine_query_parser' - 'visible' prestashop.core.grid.visible_grid_factory: class: 'PrestaShop\PrestaShop\Core\Grid\GridFactory' arguments: - '@prestashop.module.stabs.tables.grid_visible_table' - '@prestashop.module.stabs.visible_data_factory' - '@prestashop.core.grid.filter.form_factory' - '@prestashop.core.hook.dispatcher' prestashop.module.stabs.tables.grid_category_extrafield_table: class: 'PrestaShop\Module\Stabs\Tables\GridCategoryExtrafields' parent: 'prestashop.core.grid.definition.factory.abstract_grid_definition' public: true prestashop.module.stabs.tables.grid_category_extrafield_query_builder: class: 'PrestaShop\Module\Stabs\Tables\GridCategoryExtrafieldsQueryBuilder' parent: 'prestashop.core.grid.abstract_query_builder' arguments: - "@=service('prestashop.adapter.legacy.context').getContext().language.id" - "@=service('prestashop.adapter.legacy.context').getContext().shop.id" public: true prestashop.module.stabs.grid_category_extrafield_data_factory: class: 'PrestaShop\PrestaShop\Core\Grid\Data\Factory\DoctrineGridDataFactory' arguments: - '@prestashop.module.stabs.tables.grid_category_extrafield_query_builder' - '@prestashop.core.hook.dispatcher' - '@prestashop.core.grid.query.doctrine_query_parser' - 'extrafields' prestashop.core.grid.grid_category_extrafield_factory: class: 'PrestaShop\PrestaShop\Core\Grid\GridFactory' arguments: - '@prestashop.module.stabs.tables.grid_category_extrafield_table' - '@prestashop.module.stabs.grid_category_extrafield_data_factory' - '@prestashop.core.grid.filter.form_factory' - '@prestashop.core.hook.dispatcher' Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now