当我更改指标值时,我想获得指标的值。从那我想设置其他指标值。 dojo中是否有任何指标值变化的事件。我使用下面的代码,但它不起作用。警报无效。
makeGauge2 = function() {
GaugeInPounds = new dojox.gauges.GlossySemiCircularGauge({
background : [ 255, 255, 255, 0 ],
title : 'Value',
id : "glossyGauge2",
width : 300,
height : 300,
max:200,
majorTicksInterval:20,
minorTicksInterval:10
}, dojo.byId("GaugeInPounds"));
GaugeInPounds.startup();
};
dojo.ready(makeGauge);
dojo.ready(makeGauge2);
//var gauge1 = dijit.byId("GaugeInPounds");
dijit.byId("GaugeInPounds").on("startEditing", function(event){
alert(event.indicator.value);
console.log(event.indicator.value);});
答案 0 :(得分:1)
尝试这个代码可以帮助你。
<!DOCTYPE html>
<html>
<head>
<meta name="viewport"
content="width=device-width,initial-scale=1,maximum-scale=1,minimum-scale=1,user-scalable=no" />
<meta name="apple-mobile-web-app-capable" content="yes" />
<!-- dojo/javascript will go here -->
<script src="js/dojo-release-1.9.0/dojo/dojo.js" data-dojo-config="async:true"></script>
<script type="text/javascript">
//Load the widget parser and mobile base
require([ "dojox/mobile/parser", "dojo/ready", "dojo/_base/connect",
"dojox/mobile/compat", "dojo", "dojox/gauges/GlossySemiCircularGauge" ],
function(parser, ready, connect) {
// Parse the page for widgets!
parser.parse();
var glossyCircular = new dojox.gauges.GlossySemiCircularGauge({
background: [255, 255, 255, 0],
title: 'Value',
id: "glossyGauge",
width: 300,
height: 300,
}, dojo.byId("SemiCircularGauge"));
connect.connect(glossyCircular, "onValueChanged", function(){
console.log(glossyCircular.value);
});
glossyCircular.startup();
});
</script>
</head>
<body >
<div id="SemiCircularGauge" ></div>
</body>
</html>