GroupAction.js 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  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. function GroupAction()
  13. {
  14. this.m_sAction = "GroupColumn";
  15. }
  16. GroupAction.prototype = new ModifyReportAction();
  17. GroupAction.prototype.getUndoHint = function()
  18. {
  19. return RV_RES.IDS_JS_GROUP_UNGROUP;
  20. };
  21. GroupAction.prototype.updateMenu = function(jsonSpec) {
  22. jsonSpec.visible = this.ifContainsInteractiveDataContainer();
  23. if (! jsonSpec.visible)
  24. {
  25. return jsonSpec;
  26. }
  27. var selectionController = this.m_oCV.getSelectionController();
  28. var aSelectedObjects = selectionController.getAllSelectedObjects();
  29. if (aSelectedObjects.length === 0 || selectionController.getDataContainerType() != 'list')
  30. {
  31. return this.disableMenuItem(jsonSpec);
  32. }
  33. if (aSelectedObjects[0].getCellRef().getAttribute("no_data_item_column") === "true")
  34. {
  35. return this.disableMenuItem(jsonSpec);
  36. }
  37. var bDimensionalDataSource = !selectionController.isRelational();
  38. for (var index = 0; index < aSelectedObjects.length; ++index)
  39. {
  40. /* disable if a selected object is a measure and
  41. * data source is dimentional or its layout type is 'summary
  42. */
  43. if (selectionController.getUsageInfo(aSelectedObjects[index].getSelectedContextIds()[0][0]) == selectionController.c_usageMeasure &&
  44. (bDimensionalDataSource || aSelectedObjects[index].getLayoutType() === "summary")) {
  45. return this.disableMenuItem(jsonSpec);
  46. }
  47. }
  48. jsonSpec.disabled = false;
  49. jsonSpec.iconClass = "group";
  50. return jsonSpec;
  51. };
  52. GroupAction.prototype.disableMenuItem = function(jsonSpec)
  53. {
  54. jsonSpec.disabled = true;
  55. jsonSpec.iconClass = "groupDisabled";
  56. return jsonSpec;
  57. };
  58. GroupAction.prototype.addActionContextAdditionalParms = function()
  59. {
  60. return this.addClientContextData(/*maxValuesPerRDI*/3);
  61. };