It looks like you are trying to delete the old chart before inserting / disassembling the new one, but I don't think this is happening. This can cause Dojo to fix various errors.
dijit.registry.filter(function (w) {
I'm not sure what you are doing here. The filter
function returns an array of the widget for which the callback returns true. In addition, dojo.indexOf
used to search for an element in an array (I'm not sure what kind of black magic you do there: P).
I think (if I understood your intentions), you'd better:
dijit.registry.findWidgets(dojo.byId("paginas")).forEach(function(w) { w.destroy(); });
This will destroy the widget inside #paginas before pasting and parsing recently loaded HTML.
Edit:. When you click the second button and the chart is deleted, the <style>
also deleted. That's why you see artifacts from the div tooltip because it is no longer hidden by CSS. You can solve this problem by importing the claro.css file into the main file, namely:
<style type="text/css"> @import "http://ajax.googleapis.com/ajax/libs/dojo/1.7/dijit/themes/claro/claro.css"; </style>
in the main file, not in the HTML loaded with jquery (index1.php).
Frode
source share