tabulator icon indicating copy to clipboard operation
tabulator copied to clipboard

tabEndNewRow using a function does not respect the FALSE return value of the function

Open isolveit-aps opened this issue 1 year ago • 0 comments

Describe the bug tabEndNewRow parameter: When we specify if a tab-press by the user, after the last cell of the last row, will create a new row or not, this functionality supports the use of a function. But it does not respect the function's return value of false. If the function returns false value, the row gets added anyways.

Tabulator Info Tabulator version 5.6

Working Example https://jsfiddle.net/iSolveIT/kbg80a16/12/

To Reproduce

  1. Open the fiddle, and tab through the rows.
  2. After the last row, a new row gets added, even though the function returns false
  3. Try commenting out and uncomment the other variants, to compare

Expected behavior I would expect to see that a false return from the function, will not add a new row.

Additional context Why is this a good idea? I am using the tabulator control in my web app, and the table is living inside a very dynamic web-screen. I want to be able to check numerous other values on the page, for their current value, and based on those values I want to allow or prevent the user from adding a new row.

Also I need data from a few other fields values on the page to go into the new row that will be added, and this would be a great way to return that data from this "function-approach" to be put into the row, as it is being created.

This needs to be able to retrieve that data prior to the row being inserted to the table - and perhaps even if that value came from an asynchronous function, that takes a few milliseconds to produce a value. (although this last bit will probably need more investigation, if it is a good idea to use asynchronous await calls to insert a new row or not): tabEndNewRow: function(row) { return {name: getSomeAsyncValueFromBackendDatabase()}; }

isolveit-aps avatar Feb 21 '24 12:02 isolveit-aps