Tabulator: Possible misbehavior of custom formatter and onRendered after updating to 4.x

Created on 11 Dec 2018  路  2Comments  路  Source: olifolkerd/tabulator

Describe the bug
It's actually hard to explain, much easier to show. If you have a jQuery-UI spinner in a cell (and maybe other widgets too) that was built through the onRendered callback in a custom formatter function and it edits the table data on-the-fly, it seems like the formatter function appends its result to the cell instead of replacing the old content with the updated one.

Tabulator Info

To Reproduce
Steps to reproduce the behavior:

  1. Go to https://jsfiddle.net/htLj5z7a/4/
  2. Open dev tools (elements) and focus on a cell containing a ui-spinner
    image
    Everything great so far.
  3. Press increment button or use increment controls on the spinner
  4. See how Tabulator adds more and more new input and new resize handlers to the cell for each time you invoke the increment
    image

Note that these additional inputs are invisible in Chrome. Though the WebApp I'm building is made for some WebKit implementation in another application, where the inputs are actually visible and mess up the whole layout.

Expected behavior
I'd expect tabulator to replace all existing content in a cell when a setValue is called.

Desktop (please complete the following information):

  • OS: Windows 10
  • Browser Chrome, WebKit
  • Version 71

Additional context
Prior the 4.0 release I've used a MutationObserver to build the spinner after it has been added to the DOM and it worked great. With the Tabulator 4.x, neither the onRendered method nor the MutationObserver (described here https://github.com/olifolkerd/tabulator/issues/1267) work properly. So my assumption is that something about the formatters changed significantly.

Bug

All 2 comments

Hey @Nyut0n

That is definitily a bug, i will get that fixed for the next patch release.

Cheers

Oli :)

Hey @Nyut0n

I have pushed a fix for this to the master branch and will include it in this evenings patch release.

There was an issue where if a node was returned from a formatter it was being appended to the cell while the previous contents were not removed.

Cheers

Oli :)

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Manbec picture Manbec  路  3Comments

soo1025 picture soo1025  路  3Comments

tomheaps picture tomheaps  路  3Comments

mohanen picture mohanen  路  3Comments

tomvanlier picture tomvanlier  路  3Comments