# How to use editor:true feature in uitable?

**URL:** <https://discourse.nodered.org/t/how-to-use-editor-true-feature-in-uitable/46503>\
**Category:** Dashboard\
**Created:** [31 May 2021 11:14 UTC](https://discourse.nodered.org/t/how-to-use-editor-true-feature-in-uitable/46503 "2021-05-31T11:14:56Z")\
**Posts on this page:** 1\
**Showing post:** 6

<div class="post-metadata">

**Author:** ![Christian-Me](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/christian-me/32/10774_2.png) [@Christian-Me](https://discourse.nodered.org/u/Christian-Me)\
**Post date:** [1 June 2021 16:26 UTC](https://discourse.nodered.org/t/how-to-use-editor-true-feature-in-uitable/46503/6 "2021-06-01T16:26:35Z")

</div>

> [@CreativeWarlock](#):
>
> I also tried to assign a callback function globally, like this:

Where did you placed this? In a function node? This won't work as a function node runs on the backend but tabulator in the front end. This is why the call back function has to be send inside a msg.ui\_control structure **as a string** to the frontend and will be "handed over" to tabulator by ui-table (using the `new Function ('','')` constructor)

```JSON
{
    "tabulator": {
        "cellEdited": "function(cell){ debugger; this.send({ ui_control:{callback:'cellEdited'}, payload:cell.getValue(), oldValue:cell.getOldValue(), field:cell.getColumn().getField(), id:cell.getRow().getIndex() }); }"
    }
}

```

See the little difference? your code snippet defines the function in the backend where the example nodes send the code as a string:

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/d/d/dd63e48a2a7179f9e2f49c829bde439b282c2e08.png)

done correctly it should trigger the debugger (browser):

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/d/8/d89e103323478827bb09fa3e39f58d2724112967.png)

here are the modified nodes form example #6

```auto
[{"id":"7b6490b3.cd9c7","type":"function","z":"c4712650.59b5e8","name":"callback function(s)","func":"// how to use the editor to write callback functions\n// DO NOT wire this into your flow!\n// copy / paste \"function( ... }\" into the correct calback parameter\n// use the visual JSON Editor in order to take care formating inverted commas\n// use the \"debugger\" statement to debug your callback inside your browser\n\nvar topCalc = function(values, data, calcParams){\n var total = 0;\n var calc = 0;\n var count = 0;\n data.forEach(value => {\n total+=Number(value.numberValue);\n count++;\n });\n if (count>0) calc=(total/count).toFixed(2);\n return `${calc} (avg)`;\n}\n\nvar legend = function (value) {\n if (value<100) return \"<span style='color:#FF0000;'>\"+value+\"</span>\";\n else return \"<span style='color:#000000;'>\"+value+\"</span>\"; \n}\n\nvar cellEdited = function(cell){\n debugger;\n this.send({\n ui_control:{callback:'cellEdited'}, \n payload:cell.getValue(),\n oldValue:cell.getOldValue(),\n field:cell.getColumn().getField(),\n id:cell.getRow().getIndex()\n }); \n}\n\n// used by the button column\nvar btnFormatter = function(cell, formatterParams, onRendered){\n return '<button class=\"md-raised md-button md-ink-ripple\">Activate</button>';\n}","outputs":1,"noerr":0,"initialize":"","finalize":"","x":923,"y":782,"wires":[[]]},{"id":"ce8d3904.be1b08","type":"ui_button","z":"c4712650.59b5e8","name":"","group":"ff9fdb9a.7da098","order":21,"width":"4","height":"1","passthru":false,"label":"inject cellEdited callback","tooltip":"","color":"","bgcolor":"","icon":"","payload":"function(cell){ debugger; this.send({ ui_control:{callback:'cellEdited'}, payload:cell.getValue(), oldValue:cell.getOldValue(), field:cell.getColumn().getField(), id:cell.getRow().getIndex() }); }","payloadType":"str","topic":"cellEdited","topicType":"str","x":280,"y":1071,"wires":[["16664cef.5b26b3"]]},{"id":"ff9fdb9a.7da098","type":"ui_group","name":"TEST","tab":"7dcc246f.ee661c","order":1,"disp":false,"width":"8","collapse":false},{"id":"7dcc246f.ee661c","type":"ui_tab","name":"TEST","icon":"dashboard","order":3,"disabled":false,"hidden":false}]

```

Perhaps take a look on the browser debug console for any errors.

> [@CreativeWarlock](#):
>
> I'm assigning a callback function statically in the configuration of a column right away

Perhaps you can send me your node(s) how you plan to do this.

The tooltip peformance problem is totally tabulator internal - I used tabulator with more than 500k lines until chrome quits with out of memory error (but without tooltips) .... perhaps the upcoming upgrade can help here ([Failure to create my first UI table - #23 by Christian-Me](https://discourse.nodered.org/t/failure-to-create-my-first-ui-table/46087/23) but not easy to install from my fork)

---

_[View the full topic](https://discourse.nodered.org/t/how-to-use-editor-true-feature-in-uitable/46503)._
