javascript - AngularJS & Google Visualization - Visibility of $scope variables (JS) on an HTML page using a state change handler (Google API) -


i'm working on piece of code web development have page using date range , number range filter of google visualization api. @ same time i'm making use of angularjs throughout page.

now, problem follows: have table amount of entries. when applying 1 of filters, number of entries (== # of rows) shown somewhere on html page.

my intent realize using getnumberofrows() method google api , storing result in $scope variable used on page, ideally updated every time 1 of range filters change state.

i have added 3 listeners, 1 clicks on table rows (using selecthandler()) , 1 handle state changes of range filters (using separate function statechangehandler()).

i'm storing value in variable $scope.numberofrowsshown.

the whole thing works clicks (selecthandler). when clicking table row, updated correct number of rows shown calling variable on html page {{numberofrowsshown}} (angularjs).

doing exact same thing except calling function , storing variable $scope.numberofrowsshown inside statechangehandler() give me correct output in console, doesn't let me access variable calling {{numberofrowsshown}} anymore.

any ideas?

here's js code:

function selecthandler() {     // works!!     $scope.numberofrowsshown = table.getdatatable().getnumberofrows(); };  function statechangehandler() {     // not work..     $scope.numberofrowsshown = table.getdatatable().getnumberofrows();     // correct output in console..     console.log(table.getdatatable().getnumberofrows()); };  // setup listener listen clicks on table rows , process selecthandler. google.visualization.events.addlistener(table, 'select', selecthandler);  // setup listeners statechange in slider range filters. google.visualization.events.addlistener(dateoflastaccessfilter, 'statechange', statechangehandler); google.visualization.events.addlistener(timesincelastaccessfilter, 'statechange', statechangehandler); 

i've figured out. needed reload table!


Comments

Popular posts from this blog

javascript - AngularJS custom datepicker directive -

javascript - jQuery date picker - Disable dates after the selection from the first date picker -