Results 1 to 3 of 3

Thread: Set row height of a grid

  1. #1
    Sencha User
    Join Date
    Mar 2014
    Posts
    4

    Default Set row height of a grid

    Hi,

    how can I set the row height of a grid? I tried different approaches but could't find a solution.

    I'm using the LiveGridView to set the row height. The GridViewConfig is used to set the content size.
    Code:
    LiveGridView<Line> lgv = new LiveGridView<Line>();
          lgv.setForceFit( true );
          lgv.setRowHeight( 7 );
          lgv.setViewConfig( new GridViewConfig<Line>()
          {
    
    
            @Override
            public String getRowStyle( Line model, int rowIndex )
            {
              return "smallgrid";
            }
          } );
    This is the css content
    Code:
    .smallgrid td {
    	font-size: 7px;
    	background-color:yellow;
    	padding-top:0px;
    	padding-bottom:0px;
    }
    I could resize the content very well but the row height remained at 20px.

    How can I solve this issue?

    Thankyou

  2. #2
    Sencha User
    Join Date
    Jan 2015
    Posts
    29

    Default

    Have you got a solution to this?

  3. #3
    Sencha Premium Member
    Join Date
    May 2013
    Posts
    20
    Answers
    1

    Default

    I guess you have to deal with Appearances. You have to create your own
    GridAppearance class, which looks similar like the code at the bottom of this post.

    Additionally you must create a file (in this example MyGrid.css), where you override
    the styles you want to change. Copy the styles from "com/sencha/gxt/theme/base/client/grid/Grid.css". You can find this file in the source directory.

    Within your Grid you have to create a GridView when you create the Grid
    Code:
    new GridView<?>(new MyGridAppearance());
    Code:
    public class MyGridAppearance extends GridBaseAppearance {
    
        public MyGridAppearance(GridResources resources) {
            super(resources);        
        }
        
         public MyAppearance() {
            this(GWT.<MyGridResources> create(MyGridResources.class));
        }
        
        public interface MyGrid extends GridStyle {
            
        }
          
        public interface MyGridResources extends GridResources  {
            @Import(GridStateStyles.class)
            @Source({"com/sencha/gxt/theme/base/client/grid/Grid.css", "MyGrid.css"})
            @Override
            MyGrid css();
        }
          
    }

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •