var app = angular.module('dashboardApp',['ngRoute','ui.sortable','chart.js']);


app.config(function ($httpProvider) {
    delete $httpProvider.defaults.headers.common['X-Requested-With'];
});



app.controller('mainController', function ($scope, $rootScope, $http, $compile) {
    $scope.test="test";
    
    $scope.sortableOptions = {
        connectWith: ".draggable",
        handle: ".portlet-header",
        cancel: ".portlet-toggle",
        placeholder: "portlet-placeholder ui-corner-all",
        receive: function( event, ui ) {
            console.log(event);
            console.log(ui);
            var listaId=this.id;
            var cardId=ui.item[0].id;
            alert("update verso colonna :"+listaId+"\n elemento id: "+cardId);
            reloadChart(cardId);
//            $scope.moveCard(cardId,listaId);
            
            
$( ".draggable" ).sortable( "refreshPositions" );
$(".draggable").sortable( "refresh" );     
  
        }
    };

});




  function reloadChart(id){
    console.log(id);
    // angular.element(document.getElementById(id)).scope().loadChart();

console.log("resize2");
   //   $( window ).resize();

   // $('#widget6Controller').resize();
   // $('#doughnut_contracts').resize();

   //  $('#riga_2').resize();

  }




 $(function() {

      $( ".portlet" )
      .addClass( "ui-widget ui-widget-content ui-helper-clearfix ui-corner-all" )
      .find( ".portlet-header" )
      .addClass( "ui-widget-header ui-corner-all" )
      .prepend( "<span class='ui-icon ui-icon-minusthick portlet-toggle'></span>");

      $( ".portlet-toggle" ).click(function() {
        var icon = $( this );
        icon.toggleClass( "ui-icon-minusthick ui-icon-plusthick" );
        icon.closest( ".portlet" ).find( ".portlet-content" ).toggle();
      });

     $(".borders").click(function () {
         $(".draggable").toggleClass("showBorders");
     });

});




@@ -856,113 +856,311 @@
    %0A
-$( %22.draggable%22 ).sortable( %22refreshPositions%22 );%0A$(%22.draggable%22).sortable( %22refresh%22 );     %0A  %0A
+%0A%0A// for (Chart.instances in instance)%7B%0A//           // If the responsive flag is set in the chart instance config%0A//           // Cascade the resize event down to the chart.%0A//           if (instance.options.responsive)%7B%0A//             instance.resize(instance.render, true);%0A//           %7D%0A// 
         
 %7D%0A  
@@ -1155,16 +1155,20 @@
         
+%7D;%0A%0A
 %7D%0A    %7D;
@@ -1177,18 +1177,16 @@
 %7D);%0A%0A%0A%0A%0A
-  
 function
@@ -1207,277 +1207,361 @@
 d)%7B%0A
+%0A%0A
   
-  console.log(id);%0A    // angular.element(document.getElementById(id)).scope().loadChart();%0A%0Aconsole.log(%22resize2%22);%0A   //   $( window ).resize();%0A%0A   // $('#widget6Controller').resize();%0A   // $('#doughnut_contracts').resize();%0A%0A   //  $('#riga_2').resize();%0A%0A  %7D%0A%0A%0A
+corticaFireResize();%0A%0A%0A%0A%7D%0A%0A%0Afunction corticaFireResize()%7B%0Aif (document.createEvent) %7B // W3C%0A    var ev = document.createEvent('Event');%0A    ev.initEvent('resize', true, true);%0A    window.dispatchEvent(ev);%0A%7D%0Aelse %7B // IE%0A    element=document.documentElement;%0A    var event=document.createEventObject();%0A    element.fireEvent(%22onresize%22,event);%0A%7D%0A%7D;
 %0A%0A $

fix chart resize