【问题标题】:Open icCube dashboard (with parameters) by clicking on an element通过单击元素打开 icCube 仪表板(带参数)
【发布时间】:2021-01-10 18:47:30
【问题描述】:

如何在 icCube 仪表板上设置一个事件以打开另一个仪表板? (并传递选择参数)

【问题讨论】:

  • 您能否更具体地说明您要实现的目标? “嵌入式报告”是否无法满足您的需求?
  • 很遗憾没有。例如,在仪表板 1 中,我在表格上的行点击(例如“国家”)上设置了一个事件。单击该表的国家/地区时,我希望单击以打开仪表板 2,并将所选国家/地区作为仪表板 2 的过滤器

标签: javascript parameters dashboard iccube iccube-reporting


【解决方案1】:

icCube 帮助我解决了我这边的类似请求,允许“在单击图表中的行/列时钻取到 URL”问题。您可以修改它以设置 URL 以打开另一个仪表板。

以下设置打开一个新的浏览器选项卡,谷歌搜索图表中点击的行和年份过滤器的设置:

步骤:

  1. 在图表中定义一个或多个 On Click 事件,例如:On Row Click --> event:"country";
  2. 定义一个 MDX 过滤器,例如年,称它为:“年”;
  3. 在 Widget JS Hooks 中,设置“On Send Event”;
  4. 添加和修改以下代码(此代码使用您的参数打开 Google):
/**
 * Tips:
 * type  - fired event type,
 * event - fired event object (same as first element of args array),
 * args  - list of arguments passed to fireEvent function
 * 
 * Function may return:
 *  - event - will replace first element of args
 *  - args  - will replace whole args array
 *  - false - will cancel event
 */
function(context, $box, type, event, args) {    
  let yearEvent =  context.reportingContext.eventMgr_._eventValues["year"];
  if (!event.isEmptyEvent() && yearEvent && !yearEvent.isEmptyEvent() ) {      
    let win = window.open("https://www.google.com/search?q="+ event.caption() + "+" + yearEvent.caption() , '_blank');
    win.focus();
  }
  return args;
}

结果(测试)

当你点击例如国家“荷兰”,过滤器设置为“2011”--> google 打开搜索结果为“Netherlands 2011”。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2020-05-10
    • 1970-01-01
    • 1970-01-01
    • 2019-12-05
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多