|
11 | 11 |
|
12 | 12 | <Class name="DeepSee.LightPivotTable"> |
13 | 13 | <Super>%DeepSee.Component.Portlet.abstractPortlet</Super> |
14 | | -<TimeChanged>63565,62684.158342</TimeChanged> |
| 14 | +<TimeChanged>63565,64700.290542</TimeChanged> |
15 | 15 | <TimeCreated>63515,61322.546099</TimeCreated> |
16 | 16 |
|
17 | 17 | <Parameter name="INCLUDEFILES"> |
|
88 | 88 | // prevents refreshing twice at start |
89 | 89 | if (!this._INITIALIZED) { this._INITIALIZED = true; return; } |
90 | 90 |
|
91 | | - this.LightPivotTable.clearFilters(); |
| 91 | + this.LightPivotTable.CONFIG["defaultFilterSpecs"] = []; |
92 | 92 |
|
93 | 93 | // updateFilters |
94 | 94 | for (var i in controller.filters) { |
95 | | - this.LightPivotTable.setFilter(controller.filters[i].spec); |
| 95 | + this.LightPivotTable.CONFIG["defaultFilterSpecs"].push(controller.filters[i].spec); |
96 | 96 | } |
97 | 97 |
|
98 | 98 | this.LightPivotTable.refresh(); |
|
108 | 108 | ]]></Implementation> |
109 | 109 | </Method> |
110 | 110 |
|
111 | | -<Method name="onRefreshContents"> |
112 | | -<Language>javascript</Language> |
113 | | -<ClientMethod>1</ClientMethod> |
114 | | -<Implementation><![CDATA[ console.log("onRefreshContents", this); |
115 | | -]]></Implementation> |
116 | | -</Method> |
117 | | - |
118 | 111 | <Method name="InitLPT"> |
119 | 112 | <Language>javascript</Language> |
120 | 113 | <ClientMethod>1</ClientMethod> |
|
125 | 118 |
|
126 | 119 | if (!container) { |
127 | 120 | console.error("Light pivot table: Unable to get widget with ID=" + this.id); |
128 | | - setTimeout(function () { self.onCreate.call(self); }, 1); |
129 | 121 | return; |
130 | 122 | } |
131 | 123 |
|
|
146 | 138 | defaultFilters = [], |
147 | 139 | exportToExcel = !!parseInt(container.getAttribute("export-csv")); |
148 | 140 |
|
149 | | - // !ultra-bydlocode (get the widget object) |
| 141 | + // !ultra-bydlocode (get the widget object) |
150 | 142 | while (widget["parent"]) { |
151 | 143 | widget = widget["parent"]; |
152 | 144 | } |
153 | | - // !ultra-bydlocode (possible you will have better suggestions to get widget key) |
| 145 | + // !ultra-bydlocode (possible you will have better suggestions to get widget key) |
154 | 146 | widgetKey = parseInt(_.parent.parent.onwindowgrab.match(/[0-9]+/)[0]); |
155 | 147 |
|
156 | 148 | if (exportToExcel) { |
|
247 | 239 | // filtering frequent size updates as an expensive operation |
248 | 240 | this._SIZE_ADJUST_TIMEOUT = 0; |
249 | 241 | this._FIRST_TIME_SIZE_UPDATE = true; |
250 | | - /*var container = document.getElementById(this.id), |
251 | | - basicContainer = container, |
252 | | - self = this; |
253 | | -
|
254 | | - if (!container) { |
255 | | - console.error("Light pivot table: Unable to get widget with ID=" + this.id); |
256 | | - setTimeout(function () { self.onCreate.call(self); }, 1); |
257 | | - return; |
258 | | - } |
259 | | -
|
260 | | - for (i in container.childNodes) { |
261 | | - if (container.childNodes[i].className === "lpt-container") { |
262 | | - container = container.childNodes[i]; |
263 | | - break; |
264 | | - } |
265 | | - } |
266 | | -
|
267 | | - var controller, |
268 | | - source, |
269 | | - setup, |
270 | | - _ = this, |
271 | | - widget = this, // It's lie. It changes later. |
272 | | - widgetKey, |
273 | | - i, info = {}, |
274 | | - exportToExcel = !!parseInt(container.getAttribute("export-csv")); |
275 | | -
|
276 | | - if (exportToExcel) { |
277 | | - var widgetHead = document.getElementById(basicContainer.getAttribute("id").replace(/\/./, "/header")); |
278 | | - if (widgetHead) { |
279 | | - var f, |
280 | | - widgetTr = (f = function (el) {var r; if (el.tagName === "TR") return el; for (var i in el.childNodes) { r = f(el.childNodes[i]); if (r) return r; } return null; })(widgetHead); |
281 | | - if (widgetTr) { |
282 | | - var td = document.createElement("TD"); |
283 | | - td.selfW = _; |
284 | | - td.setAttribute("style", "padding-right:6px;vertical-align:bottom;"); |
285 | | - td.innerHTML = "<div class=\"zendiv\" onclick=\"this.parentNode.selfW.exportCSV.call(this.parentNode.selfW)\"><img class=\"imageLink\" src=\"deepsee/ds2_action_44.png\" title=\"Export to CSV format\"></div>"; |
286 | | - widgetTr.appendChild(td); |
287 | | - } |
288 | | - } |
289 | | - } |
290 | | -
|
291 | | - var post = function (url, data, callback) { |
292 | | -
|
293 | | - var xhr = new XMLHttpRequest(); |
294 | | - xhr.open("POST", url); |
295 | | - xhr.onreadystatechange = function () { |
296 | | - if (xhr.readyState === 4 && xhr.status === 200) { |
297 | | - callback((function () { |
298 | | - try { |
299 | | - return JSON.parse(xhr.responseText) || {} |
300 | | - } catch (e) { |
301 | | - return { |
302 | | - error: "<h1>Unable to parse server response</h1><p>" + xhr.responseText |
303 | | - + "</p>" |
304 | | - }; |
305 | | - } |
306 | | - })()); |
307 | | - } else if (xhr.readyState === 4 && xhr.status !== 200) { |
308 | | - callback({ error: xhr.responseText |
309 | | - || "Error while trying to retrieve data from server." }); |
310 | | - } |
311 | | - }; |
312 | | - xhr.send(JSON.stringify(data)); |
313 | | -
|
314 | | - }; |
315 | | -
|
316 | | - setTimeout(function() { // onCreate fired when scripts are ready, but this.parent is missed. |
317 | | -
|
318 | | - controller = _.getConnectedController(); |
319 | | -
|
320 | | - // !ultra-bydlocode (get the widget object) |
321 | | - while (widget["parent"]) { |
322 | | - widget = widget["parent"]; |
323 | | - } |
324 | | - // !ultra-bydlocode (possible you will have better suggestions to get widget key) |
325 | | - widgetKey = parseInt(_.parent.parent.onwindowgrab.match(/[0-9]+/)[0]); |
326 | | -
|
327 | | - post((source = location.origin + container.getAttribute("data-source")) + "/Widgets", { |
328 | | - Dashboard: widget["dashboardName"] |
329 | | - }, function (data) { |
330 | | - if (data.error) { |
331 | | - container.innerHTML = "<br/><br/><h3>Unable to get data from server.</h3><p>Check if data source is configured and accessible: " + source + "/Widgets" + "</p>" |
332 | | - } else { |
333 | | - for (i in data.children) { |
334 | | - if (data.children[i].key === widgetKey) { |
335 | | - info = data.children[i]; |
336 | | - break; |
337 | | - } |
338 | | - } |
339 | | - //console.log(info); |
340 | | - setup = { |
341 | | - container: container, |
342 | | - dataSource: { |
343 | | - pivot: info["dataSource"], |
344 | | - MDX2JSONSource: source, |
345 | | - basicMDX: info["mdx"] |
346 | | - } |
347 | | - } |
348 | | - if (controller && controller["data"] && controller["data"]["rowCaptions"] && typeof controller["data"]["rowCaptions"][0] === "string") setup.caption = controller["data"]["rowCaptions"][0]; |
349 | | - if (controller && controller["data"] && !setup.caption) setup.caption = controller["data"]["defaultCaption"] || ""; |
350 | | - if (info["drillDownDataSource"]) setup["drillDownTarget"] = info["drillDownDataSource"]; |
351 | | - setup["showSummary"] = !!parseInt(container.getAttribute("show-summary")); |
352 | | -
|
353 | | - _.LightPivotTable = new LightPivotTable(setup); |
354 | | - } |
355 | | - }); |
356 | | -
|
357 | | - }, 0);*/ |
358 | 242 | ]]></Implementation> |
359 | 243 | </Method> |
360 | 244 |
|
|
0 commit comments