Long strings without space breaks responsive style

Long strings without space breaks responsive style

json81json81 Posts: 24Questions: 6Answers: 1

Hi!
I have long strings in my table (URL without whitespace or paths to a file or folder). Example:
"https://support.google.com/customsearch/answer/2649143?hl=en"
or
"/home/testuser/folderwithlongtext/anotherfolder/temp/testdocument.txt"

This breaks the responsive design.

Test:

  • Open https://editor.datatables.net/ on mobile or Chrome / responsive window.
  • Add the link above to the office field.
  • Press the + button. Responsive design breaks.

What is the best way to handle this case? Render all data and check if string is to long and add whitespace? I want to show the complete string, I do not want to hide it in a <a href=...>.

Answers

  • allanallan Posts: 61,723Questions: 1Answers: 10,108 Site admin

    That's interesting - thank you.

    If you make even a 1px change in the screensize, Responsive recalculates the layout and correctly collapses the columns. So i'm thinking what probably needs to happen is that Responsive should either have a listener on draw that will always update the display on every draw (wanted to avoid that since it might not be required though and increases CPU load), or have a listener on submitComplete which would do the recalculation.

    The best option would really be to have DataTables trigger an updated event, but that isn't going to be in until v2 unfortunately.

    Leaning toward submitComplete - e.g.:

    editor.on('submitComplete', function () {
      table.responsive.recalc();
    });
    

    Allan

  • colincolin Posts: 15,144Questions: 1Answers: 2,586

    This has now been addressed. We'll be making releases this afternoon and this will be included in it,

    Colin

This discussion has been closed.