Leading spaces are getting trimmed for table data
Leading spaces are getting trimmed for table data
TheGiggler
Posts: 6Questions: 0Answers: 0
Hi!
I'm new to DataTables and it's been great and pretty easy to integrate into my app!
One quirk I've found is that, in table cells, strings that have leading spaces are being displayed without them, which could be confusing when displaying in a sorted grid.
I should note that I am doing all my sorting and paging server side and passing the aaData back via JSon, so the sort order is correct, with the strings with leading spaces in the database appearing at the top of the list, but with the leading space trimmed off, making them appear out of order when displayed.
Examining the Json via Fiddler the leading spaces are retained on the data I'm returning to the client.
I looked in the style sheets and couldn't find anything that might trim the spaces.
Am I missing something obvious?
Thanks!
I'm new to DataTables and it's been great and pretty easy to integrate into my app!
One quirk I've found is that, in table cells, strings that have leading spaces are being displayed without them, which could be confusing when displaying in a sorted grid.
I should note that I am doing all my sorting and paging server side and passing the aaData back via JSon, so the sort order is correct, with the strings with leading spaces in the database appearing at the top of the list, but with the leading space trimmed off, making them appear out of order when displayed.
Examining the Json via Fiddler the leading spaces are retained on the data I'm returning to the client.
I looked in the style sheets and couldn't find anything that might trim the spaces.
Am I missing something obvious?
Thanks!
This discussion has been closed.
Replies
[code]
words
[/code]
Has a \n and four spaces before `words` - which shouldn't be taken into account for sorting etc.
You can disable that trim, if you need to do so, by altering this line in DataTables: https://github.com/DataTables/DataTablesSrc/blob/5b2708dd876696311f76d20d26c2e312a3611041/js/core/core.data.js#L621
Allan