I am extensively using declarative dojo DataStores in my application and connecting them to various declarative data driven Widgets. The problem comes in when I attempt to "destroy" the ContentPane that contains the DataStores. All the declarative examples using datastores use the attribute jsId
to have the dojo parser set the datastore as a variable, which then the control is pointed at. For example I use the following:
<div dojoType="dojo.data.ItemFileReadStore" id="processList" jsId="processList"
url="json/processlist.json.php"></div>
<input dojoType="dijit.form.FilteringSelect" name="processSelect" id="processSelect"
value="null" store="processList" searchAttr="label" />
It works like a charm, but the problem is that when I destroy the parent ContentPane I notic开发者_开发知识库e that the variable processList
is still available in the browser. After using various parts of the application, I end up lots and lots of little data stores all over the place, which obviously is a rather large "memory leak".
How do I either avoid registering the datastore as a variable (I tried dijit.byId()
in the store
attribute without success) or how do I automatically have these datastores clean themselves up?
As per the discussion with the open ticket, version 1.4.x of dojo will not automatically delete
global variables which are created by the parser via setting the jsId
attribute. The only way currently to delete them is to manually keep track of them and issue a delete variable_name
. Some sort of long term solution for a future release of dojo is being considered.
精彩评论