Skip to content

Commit

Permalink
filters reassign fix
Browse files Browse the repository at this point in the history
  • Loading branch information
nikitaeverywhere committed Nov 29, 2014
1 parent 02a67e8 commit 04d2e85
Show file tree
Hide file tree
Showing 3 changed files with 49 additions and 28 deletions.
60 changes: 32 additions & 28 deletions export/LightPivotTable.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

<Class name="DeepSee.LightPivotTable">
<Super>%DeepSee.Component.Portlet.abstractPortlet</Super>
<TimeChanged>63519,69139.707264</TimeChanged>
<TimeChanged>63520,75672.654316</TimeChanged>
<TimeCreated>63515,61322.546099</TimeCreated>

<Parameter name="INCLUDEFILES">
Expand Down Expand Up @@ -60,6 +60,37 @@
]]></Implementation>
</Method>

<Method name="notifyViewHandler">
<FormalSpec>reason,data1,data2,data3</FormalSpec>
<Language>javascript</Language>
<ClientMethod>1</ClientMethod>
<Implementation><![CDATA[
if (!this.LightPivotTable) return;
var controller = this.getConnectedController();
if (reason === "dataChange") {
this.LightPivotTable.clearFilters();
// updateFilters
for (var i in controller.filters) {
this.LightPivotTable.setFilter(controller.filters[i].spec);
}
this.LightPivotTable.refresh();
}
]]></Implementation>
</Method>

<Method name="renderContents">
<Language>javascript</Language>
<ClientMethod>1</ClientMethod>
<Implementation><![CDATA[ this.getConnectedController(); // to receive notifications
]]></Implementation>
</Method>

<Method name="onCreate">
<Language>javascript</Language>
<ClientMethod>1</ClientMethod>
Expand Down Expand Up @@ -169,34 +200,7 @@
]]></Implementation>
</Method>

<Method name="notifyViewHandler">
<Description>
Notification that the dataController associated with this dataView has raised an event.</Description>
<FormalSpec>reason,data1,data2,data3</FormalSpec>
<Language>javascript</Language>
<ClientMethod>1</ClientMethod>
<Implementation><![CDATA[
if (!this.LightPivotTable) return;
var controller = this.getConnectedController();
if (reason === "dataChange") {
// updateFilters
for (var i in controller.filters) {
this.LightPivotTable.setFilter(controller.filters[i].spec);
}
this.LightPivotTable.refresh();
}
]]></Implementation>
</Method>

<Method name="adjustContentSize">
<Description>
Notification from the containing widget that the page is loaded or the widget is resized.
Subclass can implement this, if they wish.</Description>
<FormalSpec>load,width,height</FormalSpec>
<Language>javascript</Language>
<ClientMethod>1</ClientMethod>
Expand Down
8 changes: 8 additions & 0 deletions source/js/DataSource.js
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,12 @@ DataSource.prototype.setFilter = function (spec) {

};

DataSource.prototype.clearFilters = function () {

this.FILTERS = [];

};

/**
* @param {function} callback
*/
Expand All @@ -103,6 +109,8 @@ DataSource.prototype.getCurrentData = function (callback) {
mdx = mdxParser.applyFilter(mdx, this.FILTERS[i]);
}

console.log("MDX: " + mdx);

this._post(this.SOURCE_URL + "/" + this.ACTION, {
MDX: mdx
}, function (data) {
Expand Down
9 changes: 9 additions & 0 deletions source/js/LightPivotTable.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,15 @@ LightPivotTable.prototype.setFilter = function (spec) {

};

/**
* Clear all filters that was set before.
*/
LightPivotTable.prototype.clearFilters = function () {

this.dataSource.clearFilters();

};

LightPivotTable.prototype.pushDataSource = function (config) {

var newDataSource;
Expand Down

0 comments on commit 04d2e85

Please sign in to comment.