score:7
Accepted answer
In the example below the the p:commandButton starts the ajax request. The JSON object you want to use can be stored in the h:inputHidden field. When the p:commandButton completes the javascript function is called to update the chart. The javascript function will be able to access the JSON object from the h:inputHidden field.
xhtml
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:p="http://primefaces.prime.com.tr/ui">
<h:head>
<script type="text/javascript">
function dosomething() {
var value = jQuery("#beanvalue").attr('value');
alert(value);
}
</script>
</h:head>
<h:body>
<h:form prependId="false" >
<p:commandButton value="update" action="#{testBean.update}" update="beanvalue" oncomplete="dosomething();" />
<h:inputHidden value="#{testBean.output}" id="beanvalue" />
</h:form>
</h:body>
</html>
Bean
import javax.faces.bean.ManagedBean;
import javax.faces.bean.ViewScoped;
@ManagedBean
@ViewScoped
public class TestBean {
private String output;
public TestBean() {
output = "1";
}
public void update() {
output += "1";
}
public String getOutput() {
return output;
}
public void setOutput(String output) {
this.output = output;
}
}
Source: stackoverflow.com
Related Query
- JSF2, PrimeFaces, and Highcharts - Ajax
- Ajax and Highcharts - Display 'loading' until data is retrieved, then populate chart
- Highcharts - Global configuration with common code and unique data & Headings
- Highcharts with ajax and json data what am i doing wrong?
- Highcharts Column-chart with php and Ajax
- Return Highcharts using Ajax and Python
- JSON, Codeigniter, Highcharts and AJAX
- Converted PHP code that built an array to JS and now highcharts doesn't work - what did I do wrong?
- Dynamically adjust Y axis min/max based on ajax update and data points in Highcharts
- Highcharts Error 13 on Ajax Result and Dynamic Div
- Highcharts and Ajax using php
- how can I use rangeselector and navigation in highcharts in the given code
- Calling Highcharts export to jpeg but the source is https and exporting is http (security warnings issued by browser)
- javascript and highcharts was not getting in ajax response
- highcharts in new window with ajax and jquery
- Use JSON with HighCharts and AJAX
- Load highcharts data with laravel and ajax
- Ajax Request to Insert Highcharts into Head and Run Function
- How to create a column range chart in Highcharts using range and navigator functions?
- Hide axis and gridlines Highcharts
- Customize tooltip and format the number to 2 decimal places of highcharts
- Loading Highcharts via shim using RequireJS and maintaining jQuery dependency
- jQuery UI Tabs and Highcharts display/rendering issue
- Displaying hours and minutes on x-axis with Highcharts
- Export Highcharts to PDF (using javascript and local server - no internet connection)
- Highcharts - How to programmatically toggle legend items and determine which items are selected
- Hiding _groups_ of series in Highcharts and jQuery: how to get acceptable performance?
- how to import highcharts with webpack and babel
- debugging domjs and highcharts
- HighCharts load data via ajax
More Query from same tag
- How to use highchart pattern fill in angular?
- How to show multiple pie charts using highcharts
- How to refresh pane background when update date on gauge highcharts?
- Highcharts: alone point hard not visible with marked disabled
- HighCharts ios Disable Initial Animation
- Show line of zoomed in series when no points within zoom range using boost
- Highcharts bubbles incorrect initial size, changes on resize
- Resize highchart based on container changing NOT window resize
- How to add data dynamically to drilldown maps?
- Chart type to plot only data points
- Javascript - Page slow to show after not being the active tab
- Format data to parse to a highcharts pie chart
- highcharts tooltip not working after zoom
- jquery highcharts multiline mvc asp.net
- How to get a list of hoveredPoints in Highcharts v4?
- Highcharts {Pie} - Change dataLabels connector curve
- How to implement the KDJ indicator calculation in highcharts
- highmaps get country name on click event
- Is it possible to have multiple highcharts with one id?
- Highstock Update Data getJson
- How to label Highcharts tooltip from json data?
- Datalabels are not shown in 3D Highcharts bar/column
- highchart dateTimeLabelFormats don't work
- How to get xAxis and yAxis information on a Highcharts heatmap click event?
- Highcharts (Highcharts-Vue) Drilldown with Geojson Geometry Based Maps Fails To Display
- How to load data to highcharts from ajax?
- highcharts endOnTick option showing unspecified value on axis
- x-Axis tick alignment
- Highcharts not defined when loading map data through requirejs
- Highcharts overlay multiple datetime series