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>
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
is not function:is string
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
Speaking of which, you can eval and execute the string as a function code
But if you use vue or react framework, you can solve this problem. But this is pure html, it won’t work
Curious what do you want to do?
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
is not function:is string
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
Speaking of which, you can eval and execute the string as a function code
But if you use vue or react framework, you can solve this problem. But this is pure html, it won’t work
Curious what do you want to do?