Follow-up to a closed discussion 'Leading spaces are getting trimmed...'.

Follow-up to a closed discussion 'Leading spaces are getting trimmed...'.

mikducmikduc Posts: 31Questions: 8Answers: 0

Link to test case:
Debugger code (debug.datatables.net):
Error messages shown:
Description of problem:

Answers

  • mikducmikduc Posts: 31Questions: 8Answers: 0

    How do I locate the core data to make the change described. I am including the required .js libraries for my application but I am unable to locate where the row data is being trimmed.

  • kthorngrenkthorngren Posts: 21,444Questions: 26Answers: 4,974

    Do you have a link to the discussion?

    Kevin

  • kthorngrenkthorngren Posts: 21,444Questions: 26Answers: 4,974

    The core.data JS should be compiled into the datatables.js you download. For DT 1.10.21 the statement contents = $.trim(cell.innerHTML); is on line 3009. You should be able to search the file for trim. any changes you make will be reverted if you upgrade so you will need to make the change in the new code.

    Kevin

  • mikducmikduc Posts: 31Questions: 8Answers: 0

    I was able to download - //cdn.datatables.net/1.10.21/js/jquery.dataTables.js - to a local file and made the changes described. The changes did not effect the functionality of the script. I am concerned that this may not be the proper change because I can debug my application and the data looks correct in the SSP script but does not render correctly on the form. Am I missing something else?

  • kthorngrenkthorngren Posts: 21,444Questions: 26Answers: 4,974

    In the thread you linked Allan said:

    DataTables does do a trim on data when it is being taken from an DOM source

    Is your table data sourced from the DOM? And is the problem with leading spaces being removed?

    the data looks correct in the SSP script but does not render correctly on the form

    Can you provide more details? What is the data and how is it not rendered correctly?

    Can you provide a link to your page or a simple test case with an example of your data so we can see what is not rendered correctly?
    https://datatables.net/manual/tech-notes/10#How-to-provide-a-test-case

    Kevin

  • mikducmikduc Posts: 31Questions: 8Answers: 0

    By not rendering properly - I mean the text data in my field has leading spaces in the database but it is being stripped out on the screen.

  • kthorngrenkthorngren Posts: 21,444Questions: 26Answers: 4,974

    Based on the above you don't have a DOM sourced table so the thread you found doesn't apply. Which is good. The stripping of white space is an HTML thing. You can use a non-breaking space ( ) to show all the spaces in the table. Use -option columns.render to replace the spaces with  . You will do this for the display operation explained in the Orthogonal Data manual.

    Something similar to the "Show ellipsis" example in the columns.render docs or this example.

    Kevin

  • mikducmikduc Posts: 31Questions: 8Answers: 0

    Thanks Kevin, I will give this a try.

    Mike

This discussion has been closed.