简体   繁体   English

如何使按钮成为CDE Pentaho中表组件内部的列之一?

[英]How to make button as one of the column inside table component in CDE Pentaho?

I am trying to make the table component with the button inside the table column in CDE Pentaho. 我正在尝试使用CDE Pentaho中表格列内的按钮来制作表格组件。 How can it be achieved? 如何实现?

I guess it will need some work. 我想这需要一些工作。 In the Draw function of your table, you may put some javascript to manipulate the DOM and add your button : as far as I remember, the draw function receives a parameter that is a structure with the column and row index of the current cell. 在表的Draw函数中,您可以放置​​一些JavaScript来操作DOM并添加按钮:据我所知,draw函数接收的参数是具有当前单元格的列和行索引的结构。

Try first this code in the draw function : 首先在draw函数中尝试以下代码:

function(paramdraw) {
      console.log(paramdraw);
}

and look for the content of paramdraw iin the console. 并在控制台中查找paramdraw的内容。

Maybe there is a better way to do it... 也许有更好的方法来做...

What we do here usually is something like editing the query on the datasource with a column that output the HTML code for a button. 通常,我们在这里所做的事情类似于在数据源上编辑带有一列的查询,该列输出按钮的HTML代码。

SELECT 
    ID, 
    NAME, 
    concat('<input type="button" onclick="alert(',ID,')">click me</input>') as button 
FROM 
    foo 
WHERE 
    bar='bar';

That should display a button. 那应该显示一个按钮。 If you are not using a query as datasource, but a transformation the idea is the same. 如果您不是使用查询作为数据源,而是进行转换,则想法是相同的。 Just make the output contains a string that when interpreted by the browser is a button. 只需使输出包含一个字符串,该字符串在被浏览器解释时就是一个按钮。

Hope it helps. 希望能帮助到你。 =) =)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM