Hi All,
I created a gadget which uses *Batch Data Source*
Selected a *Bar Chart*
and set an update interval of 1000 seconds for the gadget in the dashboard
design view.
Then i viewed the gadget.
The first set of data is available to the draw function
draw = function(placeholder, chartConfig, _schema, data) {}
But then after the update interval mentioned, the following method is
getting called
​update = function(data) {}
but the data doesn't contain "data" but contains the following
function (){
$.ajax({
url: gadgetLocation + '/gadget-controller.jag?action=getData',
method: "POST",
data: JSON.stringify(conf),
contentType: "application/json",
async: false,
success: function (data) {
providerData = data;
}
});
}
If i change gadget-core.js
from
var getProviderData = function (){
$.ajax({
url: gadgetLocation + '/gadget-controller.jag?action=getData',
method: "POST",
data: JSON.stringify(conf),
contentType: "application/json",
async: false,
success: function (data) {
providerData = data;
}
});
}
var drawGadget = function (){
draw('#canvas', conf[CHART_CONF], schema, providerData);
setInterval(function() {
update(getProviderData);
},pref.getInt(REFRESH_INTERVAL));
}
to
var getProviderData = function (){
$.ajax({
url: gadgetLocation + '/gadget-controller.jag?action=getData',
method: "POST",
data: JSON.stringify(conf),
contentType: "application/json",
async: false,
success: function (data) {
providerData = data;
}
});
//ADDED
return providerData;
}
var drawGadget = function (){
draw('#canvas', conf[CHART_CONF], schema, providerData);
setInterval(function() {
//ADDED function call
update(getProviderData());
},pref.getInt(REFRESH_INTERVAL));
}
Then I'm getting the data (object array) as expected.
Any suggestion on retrieving data in the update method?
Best Regards,
--
*Ramindu De Silva*
Software Engineer
WSO2 Inc.: http://wso2.com
lean.enterprise.middleware
email: [email protected] <[email protected]>
mob: +94 772339350
mob: +94 719678895
_______________________________________________
Dev mailing list
[email protected]
http://wso2.org/cgi-bin/mailman/listinfo/dev