Re: Button and Pager is not working
Hi Paul,
Thanks..
My requirement is i need to use a button in xpage,Where iam using output script and dojo module to implement pie chart .
When i have clicked on button it is not triggering any actions...And also it is not showing any error.When i have removed output script,then it is working fine..Here is my code.
<?xml version="1.0" encoding="UTF-8"?>
<xp:view xmlns:xp="http://www.ibm.com/xsp/core" dojoParseOnLoad="true"
dojoTheme="true">
<xp:panel>
<xp:table style="width:500px">
<xp:tr>
<xp:td colspan="2" align="left" valign="top">
<xp:table>
<xp:tr>
<xp:td>
<xp:label value="No of Active AMC:" id="label4">
</xp:label>
</xp:td>
<xp:td>
<xp:text escape="true" id="actf">
<xp:this.value><![CDATA[#{javascript:1}]]></xp:this.value></xp:text>
</xp:td>
</xp:tr>
<xp:tr>
<xp:td>
<xp:label value="No of Inactive AMC:" id="label9">
</xp:label>
</xp:td>
<xp:td>
<xp:text escape="true" id="inactf">
<xp:this.value><![CDATA[#{javascript:2}]]></xp:this.value></xp:text>
</xp:td>
</xp:tr>
</xp:table>
</xp:td>
<xp:td align="left" valign="top">
<xp:panel id="simplechart" style="width:150px;height:150px">
</xp:panel>
</xp:td>
</xp:tr>
</xp:table>
<xp:text escape="true" id="seriesA" rendered="false">
<xp:this.value><![CDATA[#{javascript:var act=getComponent("actf").getValue();
var inact=getComponent("inactf").getValue();
output = "{y: " +act+ ", text: \"Active AMC \",legend: \"Active AMC\", tooltip:\"Active AMC("+act+")\"},{y: " +inact+", text: \"Inactive AMC \",legend: \"Inactive AMC\", tooltip: \"Inactive AMC(" + inact+ ")\"},";
return output}]]></xp:this.value>
</xp:text>
<xp:text escape="false" id="computedField5">
<xp:this.value><![CDATA[#{javascript:var result = "<script language=\"JavaScript\" type=\"text/javascript\">";
result += "var series1 = [";
result += getComponent("seriesA").getValue() + "];";
result += "</script>";
return result;
}]]></xp:this.value>
</xp:text>
<xp:br></xp:br>
<xp:scriptBlock id="scriptBlock1">
<xp:this.value><![CDATA[makeCharts = function(){
// Code to create the pie chart
var chart1 = new dojox.charting.Chart2D("#{id:simplechart}");
chart1.setTheme(dojox.charting.themes.PlotKit.green);
/*
Pie Chart @params
@labelStyle, @ticks, @precision, @fixed appear to have no effect
@labelOffset - the larger the positive number, the nearer the centre; the larger the negative number, the further from the centre
@radius controls the size of the pie chart
@fontColor can be colour name, rgb or hex
@font sets font elements, e.g. font: "normal normal bold 14pt Tahoma"
*/
chart1.addPlot("default", {type: "Pie", radius: 50, fontColor: "rgb(255,0,0)", labels: false});
chart1.addSeries("Series 1", series1);
//ANIMATIONS - use Magnify OR MoveSlice OR Shake
/* Magnify @params
@duration: Duration in ms
@scale: amount to expand the slice by
@shift: amount to shift from centre
*/
var anim_a = new dojox.charting.action2d.Magnify(chart1, "default", {scale: 1.2, shift: 10});
// MoveSlice has additional param @easing: various animation events, by default dojo.fx.easing.backOut.
// See dojo.fx.easing for alternatives
//var anim_b = new dojox.charting.action2d.MoveSlice(chart1, "default", {scale: 1.2, shift: 10});
/* Shake @params
@duration: Duration in ms
@easing: various animation events, by default dojo.fx.easing.backOut.
@shiftX: amount to shake in x axis
@shiftY: amount to shake in y axis
var anim_c = new dojox.charting.action2d.Shake(chart1, "default", {shiftX: 10, shiftY: 10});
*/
/* Highlight @params
@highlight: the colour of the highlight (by default negative of the colour). Can be name, rgb or hex
@duration: Duration in ms
*/
var anim_d = new dojox.charting.action2d.Highlight(chart1, "default", {highlight: "#FF0000"});
// Tooltip @param @text expects a function. This gets @tooltip or @text @param from series (in that order)
var anim_e = new dojox.charting.action2d.Tooltip(chart1, "default");
chart1.render();
var legendTwo = new dojox.charting.widget.Legend({
chart: chart1, horizontal: false
},
"#{id:Legend}");
};
XSP.addOnLoad(makeCharts);
]]></xp:this.value>
</xp:scriptBlock></xp:panel>
<xp:this.resources>
<xp:dojoModule
name="dojox.charting.themes.MiamiNice">
</xp:dojoModule>
<xp:dojoModule
name="dojox.charting.themes.PlotKit.green">
</xp:dojoModule>
<xp:dojoModule
name="dojox.charting.themes.PlotKit.blue">
</xp:dojoModule>
<xp:dojoModule
name="dojox.charting.widget.Chart2D">
</xp:dojoModule>
<xp:dojoModule
name="dojox.charting.themes.PlotKit.cyan">
</xp:dojoModule>
</xp:this.resources>
<xp:text escape="true" id="computedField2" rendered="false">
<xp:this.value><![CDATA[#{javascript:var cust = @Name("[CN]",session.getEffectiveUserName());
return cust}]]></xp:this.value>
</xp:text>
<xp:br></xp:br>
<xp:button value="Label" id="button1"><xp:eventHandler event="onclick" submit="true" refreshMode="complete">
<xp:this.action>
<xp:openPage name="/profile.xsp"></xp:openPage>
</xp:this.action></xp:eventHandler>
</xp:button>
</xp:view>