当JS函数的参数为对象时,调用时不能直接传对象,而是要将对象用户JSON转换之后才能用,如下

 JS函数参数为对象时,如何调用

JS函数参数为对象时,如何调用

 

 

特别要注意这个return "<button class='btn btn-primary btn-sm'' οnclick='toEdit(" + JSON.stringify(row) + ")'>编辑</button>";

这里的双引号 和 单引号 很容易搞混,最简单的方式就是直接复制这行代码 然后修改其中的内容

formatter: function(value, row, index) {

return "<button class='btn btn-primary btn-sm'' οnclick='toEdit(" + JSON.stringify(row) + ")'>编辑</button>";

}
 

function toAdd(){
$("#myModalLabel").text("新增");
$("#myModal").find(".form-control").val("");
$('#myModal').modal()
}
 

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-11-24
  • 2021-12-18
  • 2021-09-04
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2021-10-21
  • 2021-05-26
  • 2021-07-12
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案