Hi,
In my igGrid ,The data in one of the columns have multiple spaces between characters such as "aa bb", but when it is bounded,the extra spaces are removed and shown as "aa bb". I wanted to bind my data as is however it is there in the db. Can some one help me in fixing this issue.
Thanks & Regards
Nagaraju P
Hello Nagaraju,
How did you insert the spaces in your datasource? Did you just tap on spacebar or you used the reserved HTML non-breaking space like " "? The second one works fine on my side and displays the record with spaces. Attached is a sample for your reference.
If you have any questions, please let me know.
Sincerely,gridDSwithSpaces.zip
Tsanna
Thanks for your quick replay ,i did tap on space bar and it is saved in the database with the spaces, i tried to bind the same data which is there in the database.
Ok, ignore the editable grid. This has nothing to do with the datasource and spaces in records. Please note that including spaces through the spacebar won't render any spaces in the grid records, since spacebar spaces are ignored in HTML. Therefore you should use html reserved entity character for non-breaking space: https://www.w3schools.com/html/html_entities.asp
For the similar situation ,IG ultra web grid ,there is some thing called a property "HTMLEncodeContent" at the column level,if we set this to true ,it will work. Please refer the below link.
https://es.infragistics.com/community/forums/f/retired-products-and-controls/47078/extra-space-characters-removed-when-binding-data-to-grid
Can you please tell me ,Is there anything of such column level setting for igGrid?
No, there is not such property in igGrid. What bothers you to use the approach I suggested?
So you mean to say , we need to loop through all the columns data and whenever finds the extra spaces ,print   ,this is expensive operation and does not seems to be a feasible solution.
Instead you may use column formatter function: https://www.igniteui.com/help/api/2017.1/ui.iggrid#options:columns.formatter and get the respective value that contains spaces and replace them. Here is an example how to replace white-space: https://stackoverflow.com/questions/1731190/check-if-a-string-has-white-space
I don't think that auto-sizing has something in common with column formatting. The last operates on the datasource.
Thanks for your replay,
Is there any better solution ? because I need to implement across all my Grids and i am also not sure ,how it’s going to work across all the browsers and devices. Also can you please let me know if auto Sizing the column is turned on ,implementing the above solution is going to create any impact? if not I am ok with this solution.
Nagaraju