Created
November 24, 2015 19:51
-
-
Save marpontes/365cc9f7aad68264a79f to your computer and use it in GitHub Desktop.
Habilitando os gráficos do CDE a responderem a mudanças de layout.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* [Dashboards compatíveis com requirejs] | |
Solução componente a componente | |
-------------------------------------------------------------------- | |
Colocar no Post Execution: | |
*/ | |
function(){ | |
var comp = this, elm = $("#"+comp.htmlObject); | |
$(window).resize(function(){ | |
comp.chart.options.width = elm.width(); | |
comp.chart.render(/*bypassAnimation*/true, /*recreate*/true, /*reload*/false); | |
}); | |
} | |
/* | |
Solução para vários componentes [Dashboards compatíveis com requirejs] | |
-------------------------------------------------------------------- | |
1. Utilizar o módulo requirejs OncaseUtils [https://github.com/oncase/oncase-dash-utils/] | |
2. Colocar no Pre Execution: | |
*/ | |
function(){ | |
OU.pushResizeable(this); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Há uma implementação mais recente aqui
A gente usa essa biblioteca importada como js em dashboards do tipo RequireJS, mas a lógica de implementação é a mesma.
Essa
_pushResizable
adiciona o componente a uma lista de componentes que têm dimensões ajustadas a cada resize relevante da página.