Skip to content

Filters processing #1

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Jul 16, 2015
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 20 additions & 15 deletions export/LightPivotTable-DeepSeePortlet.xml
Original file line number Diff line number Diff line change
@@ -182,12 +182,12 @@
defaultFilters = [],
exportToExcel = !!parseInt(container.getAttribute("export-csv"));

// !ultra-bydlocode (get the widget object)
while (widget["parent"]) {
// Following "parent" until we find widget object
while (!widget["widgetKey"]) {
widget = widget["parent"];
}
// !ultra-bydlocode (possible you will have better suggestions to get widget key)
widgetKey = parseInt(_.parent.parent.onwindowgrab.match(/[0-9]+/)[0]);

widgetKey = widget["widgetKey"];

if (exportToExcel) {
var widgetHead = document.getElementById(basicContainer.getAttribute("id").replace(/\/.*/, "/header"));
@@ -233,7 +233,7 @@
(source = location.origin + "/" + container.getAttribute("data-source"))
+ "/Widgets?Namespace=" + container.getAttribute("namespace"),
{
Dashboard: widget["dashboardName"]
Dashboard: zenPage["dashboardName"]
},
function (data) {
if (data.error) {
@@ -246,16 +246,6 @@
}
}
//console.log(info);
if (info.controls instanceof Array) {
for (i in info.controls) {
if ((info.controls[i].action === "applyFilter" || info.controls[i].action === "setFilter") && info.controls[i].value) {
if ((filterValue = info.controls[i].value).charAt(0) === "%" && filterValue.indexOf(" ") > 1) {
filterValue = filterValue.split(" ")[1] + "." + filterValue.split(" ")[0]
}
defaultFilters.push(info.controls[i].targetProperty + "." + filterValue);
}
}
}
setup = {
container: container,
dataSource: {
@@ -272,6 +262,21 @@
}
}
}
// Getting filters from controller, if it has filters added from URL or default...
// such filters are marked as "transient"
if (controller.filters.length) {
for (i in controller.filters) {
if (controller.filters[i].enabled && controller.filters[i].transient)
defaultFilters.push(controller.filters[i].spec);
}
}
// ... if not, we'll get filters from widget's controls
// Only if the controller didn't have transient filters - (!defaultFilters.length)
if (!defaultFilters.length && widget.filterState instanceof Object) {
for (i in widget.filterState)
if (widget.filterState[i]) defaultFilters.push(widget.constructMDXClause(i,widget.filterState[i]));
}

if (controller.contextFilterSpec) {
defaultFilters.push(controller.contextFilterSpec);
}
2 changes: 1 addition & 1 deletion source/js/PivotView.js
Original file line number Diff line number Diff line change
@@ -801,7 +801,7 @@ PivotView.prototype.renderRawData = function (data) {
);

var formatContent = function (value, element, format) {
if (!isFinite(value)) { // not number, format as string
if (typeof(value) === 'string') { // not number, format as string
element.className += " formatLeft";
element.innerHTML = (value || "").replace(/(https?|ftp):\/\/[^\s]+/ig, function linkReplace (p) {
return "<a href='" + p