Follow-up to a closed discussion 'Leading spaces are getting trimmed...'.
Follow-up to a closed discussion 'Leading spaces are getting trimmed...'.
mikduc
Posts: 31Questions: 8Answers: 0
in DataTables
Link to test case:
Debugger code (debug.datatables.net):
Error messages shown:
Description of problem:
This discussion has been closed.
Answers
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.
Do you have a link to the discussion?
Kevin
Here is the link.
https://datatables.net/forums/discussion/13657/leading-spaces-are-getting-trimmed-for-table-data
The
core.data
JS should be compiled into the datatables.js you download. For DT 1.10.21 the statementcontents = $.trim(cell.innerHTML);
is on line 3009. You should be able to search the file fortrim
. any changes you make will be reverted if you upgrade so you will need to make the change in the new code.Kevin
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?
In the thread you linked Allan said:
Is your
table
data sourced from the DOM? And is the problem with leading spaces being removed?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
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.
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 thedisplay
operation explained in the Orthogonal Data manual.Something similar to the "Show ellipsis" example in the
columns.render
docs or this example.Kevin
Thanks Kevin, I will give this a try.
Mike