function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Persistent SysPersistent Sys 

VisualForce DOJO...URGENT

Hi Experts,

Can someone pl point us, on how to integrate dojo 1.1.1 within VF pages? Does VF has in-built support for dojo1.1.x. Looks like Force.com used to support 0.9 version of dojo natively. Is this still continued?

We want to use charting functionality extended by dojo within VF.

Any help would be appreciated. Thanks.
mtbclimbermtbclimber
You should be able to load up the dojo zip as a static resource (setup > app setup > develop > static resources) which you can then reference in your page. From there you'll be a heavy user of apex:actionFunction I suspect.  Check out the docs and the component reference for a usage example (it's the first component in the list currently :) )
Persistent SysPersistent Sys
Problem 1: Calling dojo.js from the zip archive
Solved as per your suggestion and by referring the dojo.js a URLFOR resource

Problem 2: Unable to make calls to dojo javascript lib. Foo is getting called but unable to call makeCharts().
See code below...
Code:
<apex:page>
<apex:form>
<apex:includeScript value="{!URLFOR($Resource.dojo_zip, 'dojo/dojo.js')}" />

<script type="text/javascript">
dojo.require("dojox.charting.Chart2D");
 
function foo(){
    alert('foo called');
}
makeCharts = function(){
    alert('in function');
    var chart1 = new dojox.charting.Chart2D("simplechart");
    chart1.addPlot("default", {type: "Lines"});
    chart1.addAxis("x");
    chart1.addAxis("y", {vertical: true});
    chart1.addSeries("Series 1", [1, 2, 2, 3, 4, 5, 5, 7]);
    chart1.render(); 
    alert('out of function');
};
</script>

<apex:actionFunction name="sayHello" action="makeCharts" rerender="simplechart"/>

<apex:outputPanel id="simplechart" style="width: 250px; height: 150px;">my div</apex:outputPanel>

<apex:outputPanel onclick="sayHello" styleClass="btn">Click Me</apex:outputPanel>

<apex:commandButton value="call chart" onclick="makeCharts"></apex:commandButton>

<apex:commandButton value="call foo" onclick="foo()"></apex:commandButton>
</apex:form>
</apex:page>

 

aballardaballard

onclick="makeCharts()"

maybe?

YashYash

Hi,

Add the controller in VF and add the 'testMethod' in that controller and make changes as following.

<apex:actionFunction name="sayHello" action="{!testMethod}" rerender="simplechart"/>

<apex:commandButton value="call chart" onclick= "makeCharts()" ></apex:commandButton>

Thanks

Persistent SysPersistent Sys
both the above approached did not work. Any pointers, what are we missing here?
Ron HessRon Hess
why not use

function makeCharts(){


instead of creating a variable of type function, this is closer to why you have with foo(){}