dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #17457
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 6952: Properly destroying table panels in plugin
------------------------------------------------------------
revno: 6952
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Tue 2012-05-15 23:24:12 +0200
message:
Properly destroying table panels in plugin
modified:
dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/plugin/table.js
--
lp:dhis2
https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk
Your team DHIS 2 developers is subscribed to branch lp:dhis2.
To unsubscribe from this branch go to https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk/+edit-subscription
=== modified file 'dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/plugin/table.js'
--- dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/plugin/table.js 2012-05-15 20:32:07 +0000
+++ dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/plugin/table.js 2012-05-15 21:24:12 +0000
@@ -21,6 +21,8 @@
}
};
+DHIS.table.tables = []; // element id -> grid panel
+
DHIS.table.utils = {
appendUrlIfTrue: function(url, param, expression) {
if (expression && expression == true) {
@@ -28,6 +30,11 @@
}
return url;
},
+ destroy: function(el) {
+ if (DHIS.table.tables[el]) {
+ DHIS.table.tables[el].destroy();
+ }
+ },
getDataUrl: function(conf) {
var url = conf.url + DHIS.table.finals.dataGet;
@@ -77,11 +84,12 @@
return store;
},
render: function(conf) {
+ DHIS.table.utils.destroy(conf.el);
Ext.data.JsonP.request({
url: DHIS.table.utils.getDataUrl(conf),
disableCaching: false,
success: function(data) {
- var grid = Ext.create('Ext.grid.Panel', {
+ DHIS.table.tables[conf.el] = Ext.create('Ext.grid.Panel', {
store: DHIS.table.grid.getStore(data),
columns: DHIS.table.grid.getColumnArray(data),
renderTo: conf.el