我正在创建ag-grid gridAction:
protected gridActions = {
'actions': [
{ 'name': 'OrderTracking', 'title': 'Order Tracking', 'icon': 'track_changes', 'onClick': (template) => { this.orderTracking(template); },'isVisible': (template) => { return !(template.status=="Cancelled") }},
{ 'name': 'Retry', 'title': 'Retry', 'icon': 'cached', 'onClick': (template) => { this.orderRetry(template); }, 'isVisible': (template) => { return template.hideRetry;}}
// { 'name': 'cancel', 'title': 'Cancel', 'icon': 'cancel', 'onClick': (template) => { this.onCancelClick(); } }
]
};
我想将id添加到两个按钮,该怎么做。请帮助
答案 0 :(得分:0)
尝试以下方式:
public onCancelClick() {
return (params) => {
let idMapper = 'can-id-';
return `<button data-action-type="cancel" class="btn" id="${idMapper + params.data.id}" >Cancel</button>
};
}