cvInfoBarHelper.js 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. /*
  2. *+------------------------------------------------------------------------+
  3. *| Licensed Materials - Property of IBM
  4. *| IBM Cognos Products: Viewer
  5. *| (C) Copyright IBM Corp. 2001, 2011
  6. *|
  7. *| US Government Users Restricted Rights - Use, duplication or
  8. *| disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
  9. *|
  10. *+------------------------------------------------------------------------+
  11. */
  12. var InfoBarHelper = {};
  13. InfoBarHelper.getContainerId = function(oCV, layoutIndex) {
  14. var layoutElement = oCV.getLayoutElement(layoutIndex);
  15. var lid = layoutElement.getAttribute("lid");
  16. var containerId = lid === null ? "" : lid;
  17. //The "lid" attribute is composed of layout ID + namespacePrefix + widget identifier.
  18. //We only want the layout ID, so remove the rest.
  19. containerId = containerId.replace(oCV.getViewerWidget().getViewerId(), "").replace("RAP_NDH_", "");
  20. return containerId;
  21. };
  22. InfoBarHelper.infoBarRemoveFilter = function(widgetId, layoutIndex, itemName, txtDetails) {
  23. var oCV = eval("window.oCV" + widgetId);
  24. if (typeof oCV != "undefined") {
  25. var containerId = this.getContainerId(oCV, layoutIndex);
  26. oCV.executeAction("Filter", { type:"remove", id: containerId, item: itemName, details: txtDetails });
  27. }
  28. };
  29. InfoBarHelper.infoBarRemoveSlider = function(widgetId, sliderId) {
  30. var oCV = eval("window.oCV" + widgetId);
  31. var payload = {};
  32. payload[ sliderId ] = { blockedEvents: [ '*' ] };
  33. oCV.fireWidgetEvent( "com.ibm.bux.widget.updateEventFilter", payload );
  34. if (typeof oCV != "undefined") {
  35. oCV.executeAction("UpdateDataFilter", {"filterPayload":"{ \"clientId\" :\"" + sliderId + "\"}"});
  36. }
  37. };
  38. InfoBarHelper.infoBarRemoveSort = function(widgetId, layoutIndex, itemName, byLabel) {
  39. var oCV = eval("window.oCV" + widgetId);
  40. if (typeof oCV != "undefined") {
  41. var containerId = this.getContainerId(oCV, layoutIndex);
  42. if (byLabel == "true") {
  43. oCV.executeAction("Sort", {
  44. order: "none",
  45. id: containerId,
  46. item: itemName,
  47. type: "label"
  48. });
  49. }
  50. else {
  51. oCV.executeAction("Sort", {
  52. order: "none",
  53. id: containerId,
  54. item: itemName
  55. });
  56. }
  57. }
  58. };