Skip to content

Commit

Permalink
Passing a controller object to widget
Browse files Browse the repository at this point in the history
  • Loading branch information
mistercrunch committed Dec 18, 2015
1 parent 47bb6b6 commit 5435f53
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 4 deletions.
15 changes: 12 additions & 3 deletions panoramix/static/panoramix.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,19 +25,28 @@ var px = (function() {
dttm += 10;
$('#timer').text(Math.round(dttm/10)/100 + " sec");
}
var done = function (data) {
var controler = {
done: function (data) {
clearInterval(timer);
token.find("img.loading").hide();
if(data !== undefined)
$("#query_container").html(data.query);
$('#timer').removeClass('btn-warning');
$('span.query').removeClass('disabled');
$('#timer').addClass('btn-success');
}
},
error: function (data) {
clearInterval(timer);
token.find("img.loading").hide();
$('#timer').removeClass('btn-warning');
$('span.query').removeClass('disabled');
$('#timer').addClass('btn-error');
}
};
widget = {
render: function() {
timer = setInterval(stopwatch, 10);
user_defined_widget.render(done);
user_defined_widget.render(controler);
},
resize: function() {
user_defined_widget.resize();
Expand Down
2 changes: 1 addition & 1 deletion panoramix/static/widgets/viz_table.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ px.registerWidget('table', function(data_attribute) {
var err = '<div class="alert alert-danger">' + xhr.responseText + '</div>';
token.html(err);
token.show();
done();
ctrl.done();
});
}

Expand Down

0 comments on commit 5435f53

Please sign in to comment.