Can I specify a function function in the data-* attribute?
For example, if I write like this, I will get an error formatter is not a function:
<th data-formatter="test3(value, row, index)">field_name_cn</th>
迷茫2017-06-24 09:45:53
Eval is enough, but I think your way of solving the problem is unreasonable. Why not tell us your needs and see if there is a good solution
typecho2017-06-24 09:45:53
No.data-attribute is still an attribute, its value is just a string.
The function can be converted into a string, but of course it loses the characteristics of the function
阿神2017-06-24 09:45:53
Speaking of which, you can eval and execute the string as a function code
代言2017-06-24 09:45:53
But if you use vue or react framework, you can solve this problem. But this is pure html, it won’t work