原因:因为直接字符串作为参数需要加单引号,不然就判定为为定义的参数
function option(value, row, index)
{
var htm = "";
htm += '<button id="dupdevice" deviceId="' + value +'" onclick="updDevice(' + value + ')">导入</button>'
return htm;
}
解决方案:onclick里面加入转义字符\'
function option(value, row, index) {
var htm = "";
htm += '<button class="btn btn-primary btn-sm" id="' + value +'" onclick="updDevice(\'' + value + '\')">导入</button>'
return htm;
}
完美解决