Skip to content Skip to sidebar Skip to footer

Tapestry 5.4 Call Jquery More Than Once

I am trying to integrate Bootstrap to my Tapestry 5.4-alpha-14 application. I am new to Tapestry, and I am not sure how to use javascript there. My problem is that I want to show

Solution 1:

require.js will only execute the body of your js once. You should define a function which is configured once but executed multiple times.

popover.js

define(["jquery"], function($) {
    var privateFunc = function(args) {
        options = {
            placement:'right',
            trigger: 'hover',
            container: 'body',
            html: true
        };
        $('.pop').popover(options);
        $('.pop').popover('show');
    };
    return { publicFunc: privateFunc};
});

java code

ajaxResponseRenderer.addCallback(newJavaScriptCallback() {
    publicvoidrun(JavaScriptSupport javaScriptSupport) {
        JSONObject args = newJSONObject("foo", "bar");
        javaScriptSupport.require("popover").invoke("publicFunc").with(args);
    }
});

See here for more info

Post a Comment for "Tapestry 5.4 Call Jquery More Than Once"