Hello Forum
I want to add a custom validator to my ui_table. (Tabulator)
The validator should only allow numbers smaller than the next number. I wrote this function for that:
function(cell){
if (parseInt(cell.getRow().getData().temp) >= parseInt(cell.getRow().getNextRow().getData().temp)){
return false;
} else {
return true;
}
}
I don't know why this function doesn't work. I can write any number and its every time true. Can somebody help me?
Here is my example flow.
[{"id":"5b4f0a48.cd4824","type":"change","z":"f6f2187d.f17ca8","name":"cell","rules":[{"t":"set","p":"ui_control","pt":"msg","to":"{\"tabulator\":{\"dataTree\":true,\"dataTreeStartExpanded\":true,\"headerSort\":false,\"columns\":[{\"title\":\"Temp\",\"field\":\"temp\",\"width\":75,\"validator\":\"function(cell){ if (parseInt(cell.getRow().getData().temp) >= parseInt(cell.getRow().getNextRow().getData().temp)){ return false; } else { return true; } }\",\"editor\":\"input\"}]}}","tot":"json"}],"action":"","property":"","from":"","to":"","reg":false,"x":390,"y":1560,"wires":[["f2fb8c94.9fac8"]]},{"id":"e3fd8eb2.ae938","type":"inject","z":"f6f2187d.f17ca8","name":"","props":[{"p":"payload"}],"repeat":"","crontab":"","once":true,"onceDelay":0.1,"topic":"","payload":"true","payloadType":"bool","x":150,"y":1560,"wires":[["5b4f0a48.cd4824"]]},{"id":"f2fb8c94.9fac8","type":"ui_table","z":"f6f2187d.f17ca8","group":"f5590bd1.99e118","name":"","order":0,"width":"10","height":"16","columns":[],"outputs":1,"cts":true,"x":590,"y":1540,"wires":[["e08841e3.3c0eb"]]},{"id":"e08841e3.3c0eb","type":"debug","z":"f6f2187d.f17ca8","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":730,"y":1560,"wires":[]},{"id":"bd2e30a6.8a5ae","type":"inject","z":"f6f2187d.f17ca8","name":"","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":"0.6","topic":"","payload":"[{\"temp\":25},{\"temp\":21},{\"temp\":25},{\"temp\":21}]","payloadType":"json","x":420,"y":1500,"wires":[["f2fb8c94.9fac8"]]},{"id":"f5590bd1.99e118","type":"ui_group","name":"TEst","tab":"b8f07099.628d7","order":1,"disp":true,"width":"24","collapse":false},{"id":"b8f07099.628d7","type":"ui_tab","name":"TableTest","icon":"dashboard","disabled":false,"hidden":false}]