Inline edit alignment off when initial value shorter than new value

Inline edit alignment off when initial value shorter than new value

plannerdevplannerdev Posts: 2Questions: 1Answers: 0

Link to test case: http://live.datatables.net/piyizowi/1/edit

Debugger code (debug.datatables.net): N/A

Error messages shown: N/A

Description of problem:
On the test case page, without resizing it, set someone to have a salary in the millions, instead of thousands. When blurring, the datatable will resize to show the full enlarged salary value. But if one edits the same value again, the column will shrink back to the original size, hiding some of the digits. It would be very cool to have a way to let auto-size be retained when inline editing.

Thank you for a great tool!

This question has an accepted answers - jump to answer

Answers

  • allanallan Posts: 54,523Questions: 1Answers: 8,525 Site admin
    Answer ✓

    Interesting one! This can help:

              editor.on('submitComplete', function () {
                table.columns.adjust();
              })
    

    http://live.datatables.net/piyizowi/2/edit

    But it needs enough horizontal space on the table for the "worse case" to work without collapsing the table (i.e. the longest string from each column all in a single row - which is how DataTables performs the column width calculations).

    So it works nicely when I have the output around 960px in that example, but it still needs to adjust between pages when the output is around 770px.

    It isn't perfect, but that's the best short term option. Beyond that, I'm going to need to think on this a bit!

    Allan

  • plannerdevplannerdev Posts: 2Questions: 1Answers: 0

    Thanks Allan for the quick response! Increasing the default column width in the columnDefs to a big enough value works around this for now, thanks for keeping this small nit in mind.

Sign In or Register to comment.