|
This example demonstrates processing chart's click event on the server side using POST http request. For more
information about different ways of processing on click events please refer to the Developer's Guide.
To process onClick event using POST http request first of all define javascript: OnClick event
handler for the chart. For example:
javascript:onChartEvent($(colIndex), $(rowIndex))
Next, define a form that keeps selected indicies and can be submitted to the server. For example:
<form method=POST name=OnClickForm [action="mypage.jsp"]>
<input type=hidden name=colIndex value="">
<input type=hidden name=rowIndex value="">
</form>
Finally, declare client-side event handler the same way we defined it for processing the events on the client side:
function onChartEvent(colIndex, rowIndex) {
document.OnClickForm.colIndex.value = colIndex;
document.OnClickForm.rowIndex.value = rowIndex;
document.OnClickForm.submit();
}
The above code will cause the page specified in the action attribute of OnClickForm (or the current page) to receive and process
HTTP POST request. You can obtain the values of the selected row and column indicies by using standard HttpServletRequest
request.getParameter() function and take the appropriate actions based on these values.
The sample processes POST request and displays the column and row labels and the value of the clicked element.
|