My Angular controller looks like this (only a snippet)
$scope.ajaxData = [];
$scope.fetchData = function() {
$http.get("/getdata").success(function(data) {
$scope.ajaxData = data;
});
}
.
.
.
myApp.directive('chart', function(){
return{
restrict: 'E',
link: function(scope, elem, attrs){
scope.$watch('ajaxData', function(dataset){
// Draw Flot chart
}
}
}
.
.
$scope.gridOptions = getPQGrid();
My other javascript looks like:
function getPQGrid() {
var pqGridObj = {
width: "80%",
height: 800,
resizable: true,
title: "Angularjs grid",
scrollModel: { autoFit: true },
dataModel: { data: 'ajaxData' },
colModel : getColumnModel()
};
return pqGridObj;
}
function getColumnModel() {
var cols = [
{ title: "Instance", width: 100, dataType: "String", dataIndx: "inst" },
{ title: "Trend", width: 150, template: "<chart ng-model='ajaxData' type='line'><div class="mychart" style='width:170px;height:35px'></div></chart>' "
}
];
return cols;
}
I get the table populated but charts are not coming. If I use simple table (without pqgrid) charts are coming. So, I am guessing I am missing something.