Skip to content

Commit 04d2e85

Browse files
filters reassign fix
1 parent 02a67e8 commit 04d2e85

File tree

3 files changed

+49
-28
lines changed

3 files changed

+49
-28
lines changed

export/LightPivotTable.xml

Lines changed: 32 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111

1212
<Class name="DeepSee.LightPivotTable">
1313
<Super>%DeepSee.Component.Portlet.abstractPortlet</Super>
14-
<TimeChanged>63519,69139.707264</TimeChanged>
14+
<TimeChanged>63520,75672.654316</TimeChanged>
1515
<TimeCreated>63515,61322.546099</TimeCreated>
1616

1717
<Parameter name="INCLUDEFILES">
@@ -60,6 +60,37 @@
6060
]]></Implementation>
6161
</Method>
6262

63+
<Method name="notifyViewHandler">
64+
<FormalSpec>reason,data1,data2,data3</FormalSpec>
65+
<Language>javascript</Language>
66+
<ClientMethod>1</ClientMethod>
67+
<Implementation><![CDATA[
68+
if (!this.LightPivotTable) return;
69+
70+
var controller = this.getConnectedController();
71+
72+
if (reason === "dataChange") {
73+
74+
this.LightPivotTable.clearFilters();
75+
76+
// updateFilters
77+
for (var i in controller.filters) {
78+
this.LightPivotTable.setFilter(controller.filters[i].spec);
79+
}
80+
81+
this.LightPivotTable.refresh();
82+
83+
}
84+
]]></Implementation>
85+
</Method>
86+
87+
<Method name="renderContents">
88+
<Language>javascript</Language>
89+
<ClientMethod>1</ClientMethod>
90+
<Implementation><![CDATA[ this.getConnectedController(); // to receive notifications
91+
]]></Implementation>
92+
</Method>
93+
6394
<Method name="onCreate">
6495
<Language>javascript</Language>
6596
<ClientMethod>1</ClientMethod>
@@ -169,34 +200,7 @@
169200
]]></Implementation>
170201
</Method>
171202

172-
<Method name="notifyViewHandler">
173-
<Description>
174-
Notification that the dataController associated with this dataView has raised an event.</Description>
175-
<FormalSpec>reason,data1,data2,data3</FormalSpec>
176-
<Language>javascript</Language>
177-
<ClientMethod>1</ClientMethod>
178-
<Implementation><![CDATA[
179-
if (!this.LightPivotTable) return;
180-
181-
var controller = this.getConnectedController();
182-
183-
if (reason === "dataChange") {
184-
185-
// updateFilters
186-
for (var i in controller.filters) {
187-
this.LightPivotTable.setFilter(controller.filters[i].spec);
188-
}
189-
190-
this.LightPivotTable.refresh();
191-
192-
}
193-
]]></Implementation>
194-
</Method>
195-
196203
<Method name="adjustContentSize">
197-
<Description>
198-
Notification from the containing widget that the page is loaded or the widget is resized.
199-
Subclass can implement this, if they wish.</Description>
200204
<FormalSpec>load,width,height</FormalSpec>
201205
<Language>javascript</Language>
202206
<ClientMethod>1</ClientMethod>

source/js/DataSource.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,12 @@ DataSource.prototype.setFilter = function (spec) {
8989

9090
};
9191

92+
DataSource.prototype.clearFilters = function () {
93+
94+
this.FILTERS = [];
95+
96+
};
97+
9298
/**
9399
* @param {function} callback
94100
*/
@@ -103,6 +109,8 @@ DataSource.prototype.getCurrentData = function (callback) {
103109
mdx = mdxParser.applyFilter(mdx, this.FILTERS[i]);
104110
}
105111

112+
console.log("MDX: " + mdx);
113+
106114
this._post(this.SOURCE_URL + "/" + this.ACTION, {
107115
MDX: mdx
108116
}, function (data) {

source/js/LightPivotTable.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,15 @@ LightPivotTable.prototype.setFilter = function (spec) {
6161

6262
};
6363

64+
/**
65+
* Clear all filters that was set before.
66+
*/
67+
LightPivotTable.prototype.clearFilters = function () {
68+
69+
this.dataSource.clearFilters();
70+
71+
};
72+
6473
LightPivotTable.prototype.pushDataSource = function (config) {
6574

6675
var newDataSource;

0 commit comments

Comments
 (0)