We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Option to turn off whitespace trimming in edited grid cells

Hello, we've got a grid where we want to display the whitespace that the user has input.

Currently the grid is trimming the whitespace when the user saves (or cancels an edit) of a cell that has leading whitespace.
Is there an option to disable this trim?

I've attached a gif of the current behaviour.

Attachment: WhiteSpaceTrimmedOnSave_a6fb6065.zip

1 Reply

SS Seeni Sakthi Kumar Seeni Raj Syncfusion Team June 14, 2017 09:42 AM UTC

Hi Robert,  
 
Thanks for contacting Syncfusion Support. 
 
By default, wrapping will not be applied to the Grid. Henceforth, the Grid content will trim the leading white-spaces. To overcome this, we must customize the Grid cells by white-space CSS property. We have included the cssClass property to add this customization as shown in the following code example.  
 
       <style> 
              .e-grid.noWrap .e-rowcell { 
                     white-space: pre-wrap !important; 
              } 
       </style> 
     <div id="Grid"></div> 
    <script type="text/javascript"> 
        $(function () { 
            $("#Grid").ejGrid({ 
                dataSource: window.gridData, 
                allowPaging: true, 
                cssClass: "noWrap", 
                editSettings: { allowEditing: true, allowAdding: true, allowDeleting: true }, 
                  .. .  
                      . . . 
            }); 
        }); 
    </script> 
 
 
 
Refer to the following API References.  
 
 
We have prepared a sample demo.  
 
 
Regards,  
Seeni Sakthi Kumar S. 


Loader.
Up arrow icon