This is a migrated thread and some comments may be shown as answers.

Prevent white-space removal

2 Answers 1365 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Ron
Top achievements
Rank 1
Iron
Iron
Ron asked on 21 Feb 2019, 09:32 PM

With the Kendo Angular grid is there an inline command that can be placed in a <kendo-grid-column> to block or prevent the automatic string editing? It seems like the grid binding trims spaces by default and I'd like to selectively override this feature.

2 Answers, 1 is accepted

Sort by
0
Svet
Telerik team
answered on 25 Feb 2019, 09:31 AM
Hi Ron,

The described behavior is caused by the default HTML functionality. If we place some text with preceding white space inside a div, the white space will be trimmed.

As a workaround we could apply the custom style white-space: pre; to a div inside an ng-template with a kendoGridCellTemplate directive, targeting the columns for which we want to keep the white space. Check the following example demonstrating this approach:
https://stackblitz.com/edit/angular-5-tutorial-dgfpyw?file=app%2Fapp.component.ts

I hope this helps.

Regards,
Svetlin
Progress Telerik
Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
Todd
Top achievements
Rank 1
commented on 03 Aug 2023, 10:20 AM

How would this be done in KendoUI for JQuery?
Georgi Denchev
Telerik team
commented on 04 Aug 2023, 01:53 PM

Hi, Todd,

The approach with the jQuery Grid will be the exact same. You can use the columns.template to apply the custom style(conditionally if you want to).

Here's a Dojo example that you can examine:

https://dojo.telerik.com/@gdenchev/ikIqilUX 

Best Regards,

Georgi

0
Kristiyan
Top achievements
Rank 1
answered on 06 Aug 2019, 08:24 AM
[quote]Svetlin said:Hi Ron,

The described behavior is caused by the default HTML functionality. If we place some text with preceding white space inside a div, the white space will be trimmed.

As a workaround we could apply the custom style white-space: pre; to a div inside an ng-template with a kendoGridCellTemplate directive, targeting the columns for which we want to keep the white space. Check the following example demonstrating this approach:
https://stackblitz.com/edit/angular-5-tutorial-dgfpyw?file=app%2Fapp.component.ts

I hope this helps.

Regards,
Svetlin
Progress Telerik
Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.

[/quote]

 

This helped a lot. Thanks!

Tags
Grid
Asked by
Ron
Top achievements
Rank 1
Iron
Iron
Answers by
Svet
Telerik team
Kristiyan
Top achievements
Rank 1
Share this question
or