Search code examples
symfonyorocrmorocommerce

How to use datagrid's export feature in the frontend


I created a datagrid in the front end, and when I use the export function, js reports an error, Export does not generate a corresponding url. Can I use export on the frontend? enter image description here

router.js?version=b1068982:243 Uncaught Error: The route "oro_datagrid_export_action" does not exist.
at Router.getRoute (router.js?version=b1068982:243)
at Router.generate (router.js?version=b1068982:266)
at ExportAction.getLink (abstract-action.js?version=b1068982:311)
at ExportAction.<anonymous> (export-action.js?version=b1068982:74)
at underscore.js?version=b1068982:73
at Function._.each._.forEach (underscore.js?version=b1068982:153)
at ExportAction.<anonymous> (export-action.js?version=b1068982:69)
at triggerEvents (backbone.js?version=b1068982:369)
at triggerApi (backbone.js?version=b1068982:356)
at eventsApi (backbone.js?version=b1068982:155)

Solution

  • This functionality is not available for the storefront out of the box.

    You can make it work with customization:

    • Create a separate controller or at least a separate route for the frontend, depending on your needs.
    • Update the javascript module to use a new route for the link. The new route must have frontend: true option, in order to be used on a storefront.