如何在Datatables函数中传递参数

时间:2018-11-22 10:55:30

标签: javascript jquery datatables

我想在我的数据表函数中传递1个参数:addfctCallback

var buttons = [];
buttons.push({
  text: '<span class="glyphicon glyphicon-plus"></span> new',
  className: 'product-add btn btn-success btn-xs',
  titleAttr: 'add a product',
  action: addfctCallback  // how to pass the parameter here?
}

我想在函数addfctCallback中获取'param':

function addfctCallback(e, param) {
  console.log('param : ' + param);
}

谢谢

1 个答案:

答案 0 :(得分:1)

docs

复制面食
action: function ( e, dt, node, config ) {
                    alert( 'Activated!' );
                    this.disable(); // disable button
                }