Michał
Michał

Reputation: 143

Ajax update javascript script in primefaces

I want to ajax update javascript script using with primefaces.

 <script type="text/javascript">
    <!--
    function lineChartExtender(){
        this.cfg.highlighter = {
            showTooltip: true,
            tooltipAxes: 'both',
            tooltipLocation: 'n'
        };
        this.cfg.seriesDefaults = {
                showMarker: #{query.stringMarker}
        };
    }        -->
    </script>

How I can do that value in showMarker will be ajax update?

Upvotes: 1

Views: 5872

Answers (1)

Kuba
Kuba

Reputation: 2089

put it in a JSF tag, and give it Id.

<h:panelGroup id="myScript">
   <script type="text/javascript">

     function lineChartExtender(){
         this.cfg.highlighter = {
             showTooltip: true,
             tooltipAxes: 'both',
             tooltipLocation: 'n'
        };
         this.cfg.seriesDefaults = {
                 showMarker: #{query.stringMarker}
         };
      }       
    </script>
</h:panelGroup>

and have a button or link that does some action, or not, and updates this <h:panelGroup>

<h:commandLink action="#{myBean.doSomething}" update="myScript"/> 

Upvotes: 2

Related Questions