Search code examples
javascriptjqueryajaxpentahodashboard

Pentaho CDE Dashboard BI (Auto refresh + Onclick refresh Functionality ) Creates Error in console


I Created Dashboard with 4 tabs and multiple components(Bar graphs, Pie charts. Tables) on Each Tabs

I am trying to show Live Data on On it from MySQL Database ..

Auto refresh : - So i keep rendering all components of Selected tab for 60 secs using

Dashboards.update(render_Componentname);  

Onclick refresh :- also i have same render call in Layout panel with java Script for Tab onclick render for respective Components

I used this Function for resizing component in Pre Execution

var myself = this;
myself.chartDefinition.width = myself.placeholder().width();


if (!this.resizeHandlerAttached){

var debouncedResize = _.debounce(function(){
  myself.placeholder().children().css('visibility','visible');
  myself.chartDefinition.width = myself.placeholder().width();
  myself.render( myself.query.lastResults() );
}, 200);  

$(window).resize(function(){

  if ( myself.chartDefinition.width != myself.placeholder().width()){
    myself.placeholder().children().css('visibility','hidden');
    debouncedResize();
  }    
});

 $("#link1").click(function(){
    myself.placeholder().children().css('visibility','hidden');
    debouncedResize();
});


this.resizeHandlerAttached = true;  

So while Navigating through Tabs I am getting following error (For Each component which includes above function)

Error :- "Uncaught NoCachedResults "  

i doubt (as it render again with Onclick Javascript in Layout panel) may be it is conflicting ..

I am getting Error in console for this line of Code

code :- myself.render( myself.query.lastResults() );  

I checked cdf-bootstrap-script-includes.js from this error is coming

Any Example for Same which includes Auto refresh + Onclick tabs refresh

Please help me with this

Thanks in Advance ...


Solution

  • Solved Finally..!!

    Issue was with calling Same function for my htmlobject which is of no use ,component was rendering anyways , so removed .

    Updated function

    var myself = this;
    myself.chartDefinition.width = myself.placeholder().width();
    
    
     if (!this.resizeHandlerAttached){
    
       var debouncedResize = _.debounce(function(){
         myself.placeholder().children().css('visibility','visible');
         myself.chartDefinition.width = myself.placeholder().width();
         myself.render( myself.query.lastResults() );
       }, 200);
    
       $(window).resize(function(){
    
         if ( myself.chartDefinition.width != myself.placeholder().width()){
           myself.placeholder().children().css('visibility','hidden');
           debouncedResize();
         }    
       });
    
      this.resizeHandlerAttached = true;