Feature conflict - ellipsize / invalidate

Feature conflict - ellipsize / invalidate

sronsieksronsiek Posts: 52Questions: 11Answers: 0
edited December 2021 in Free community support

I have fairly complex table where every cell is editable. Some cells are dependant on others, ie a single cell edit may affect multiple cells within a row. Edit is done with jeditable, and jquery is used to update to the dom. After this I use row.invalidate() to update DataTables internals with the changes.

One of the table columns is a textarea, so there is an ellipsize function (similar to the plugin offered here) to present a shortened string when not editing. This is called in render (type display). As the string is editable, this returns an HTML snippet (anchor etc) - so it is modifying the dom.

The issue I'm hitting is that row.invalidate() is reading the ellipsized string in the dom and storing it internally, ie the full-text version of the string is overwritten. A subsequent edit renders the ellipsized string in the edit form.

What is the correct way to handle this?

Answers

  • sronsieksronsiek Posts: 52Questions: 11Answers: 0

    Small correction (too late to edit original post): actual invalidate call is

    row.invalidate( 'dom' ).

  • colincolin Posts: 15,118Questions: 1Answers: 2,583

    I would suggest looking at Editor - as that's been designed to make the editing of DataTables easy. The updates there happen without a need to invalidate the data.

    Colin

  • sronsieksronsiek Posts: 52Questions: 11Answers: 0

    Solved by by replacing the ellipsis function with css:

    text-overflow: ellipsis;

Sign In or Register to comment.