pagy_bootstrap_nav_js
not working - others are
#574
-
Beta Was this translation helpful? Give feedback.
Replies: 4 comments 3 replies
-
You may have a javascript error before the init of the helper that doesn't print out anything. Please, try to remove all your javascripts from a test page and load only the helper in order to check that pagy works at least on its own. |
Beta Was this translation helpful? Give feedback.
-
further to what ddnexus has said: it is likely that the JS is not being initialized. If you're using rails, why not use a stimulus controller to do it? Reference: https://ddnexus.github.io/pagy/docs/api/javascript/setup/#3-initialize-pagy |
Beta Was this translation helpful? Give feedback.
-
I can't seem to get the Rails with assets pipeline part configuring correctly. I've tried both Sprockets and Importmaps but I'm still getting the following error:
|
Beta Was this translation helpful? Give feedback.
-
Thanks all, not sure if it's my lack of understanding on how front end bundlers work, but I seem to have a working
package.json: "scripts": {
"build": "NODE_PATH=\"$(bundle show 'pagy')/lib/javascripts\" esbuild app/javascript/*.* --bundle --sourcemap --outdir=app/assets/builds --public-path=/assets --loader:.js=jsx", app/javascript/controllers/pagy_controller.js: import { Controller } from "@hotwired/stimulus"
import Pagy from "pagy-module";
export default class extends Controller {
connect() {
Pagy.init(this.element)
}
} I didn't need to do any of the Rails with assets pipeline section, which is the part that confused me. In any case, it seems to be working 🙂 thanks all for the help. EDIT: I see that I need to define steps in the initializer |
Beta Was this translation helpful? Give feedback.
further to what ddnexus has said:
it is likely that the JS is not being initialized. If you're using rails, why not use a stimulus controller to do it? Reference: https://ddnexus.github.io/pagy/docs/api/javascript/setup/#3-initialize-pagy