Ticket T732291
Visible to All Users

DataGrid - row max height

created 6 years ago

Hello,

We're running into a problem with the dxdatagrid. We want to limit the height of a row, to avoid a row with a lot of data to fill up a lot of the page. However, we haven't found a way to do this. I've taken a look at the onRowPrepared method to see if I can add some css to the row to set a max-height, but setting a max height on a tr or a td doesn't have any effect.

I'm looking for a global solution, since our datagrids are used in lots of places in our product. So just changing the contents of a specific cell to not become very high is not really an option for us.

Answers approved by DevExpress Support

created 6 years ago

Hello Hilbert,

DataGrid displays ellipsis if the wordWrapEnabled option is not set and the cell text does not fit into a cell. In this case, the row height is not increased. Take a look at this CodePen sample page.
If this approach doesn't meet your requirements, would you please provide your DataGrid configuration and a screenshot of the issue so we can provide you with the most suitable solution?

Regards,
Romeo

    Show previous comments (3)
    Alessandro (DevExpress Support) 6 years ago

      Hi,

      <<<
      However, setting a max-height doesn't work on a tr or td. I've now tried a solution by adding a div around the contents of EVERY cell in the datagrid, and setting a max height on them.
      >>>

      Yes, our DataGrid renders its content by using the HTML Tables. As mentioned on the How to set maximum height for table-cell? webpage, there is no direct approach to limit the table row/cell height because it always depends on content. So, the only solution is to wrap its content into an extra DIV element with a limited height.

      You can use the cellTemplate in the context of our DataGrid control to customize the cell's markup.

      Should you need further clarification, feel free to ask. I will be happy to help you.

      HL HL
      Hilbert Leijen 6 years ago

        Ok thanks, that's what I was afraid of. We'll keep the current workaround in place then.

        Alessandro (DevExpress Support) 6 years ago

          Please feel free to contact us at any time. We will be happy to assist you.

          Disclaimer: The information provided on DevExpress.com and affiliated web properties (including the DevExpress Support Center) is provided "as is" without warranty of any kind. Developer Express Inc disclaims all warranties, either express or implied, including the warranties of merchantability and fitness for a particular purpose. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.

          Confidential Information: Developer Express Inc does not wish to receive, will not act to procure, nor will it solicit, confidential or proprietary materials and information from you through the DevExpress Support Center or its web properties. Any and all materials or information divulged during chats, email communications, online discussions, Support Center tickets, or made available to Developer Express Inc in any manner will be deemed NOT to be confidential by Developer Express Inc. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.