Results 1 to 4 of 4

Thread: How to style multiple grids differently

    Success! Looks like we've fixed this one. According to our records the fix was applied for EXTGWT-2803 in 3.1 beta.
  1. #1
    Sencha User
    Join Date
    Dec 2012
    Posts
    4
    Vote Rating
    0
      0  

    Default How to style multiple grids differently

    I created a class named FileGridAppearance like this:
    Code:
    public class FileGridAppearance extends GridBaseAppearance {
    
        public interface FileGridStyle extends GridStyle {
    
    
        }
    
    
        public interface FileGridResources extends GridResources {
            @Source({
                    "com/sencha/gxt/theme/base/client/grid/Grid.css", "FileGrid.css"
            })
            @Override
            FileGridStyle css();
        }
    
    
        public FileGridAppearance() {
            this(GWT.<FileGridResources> create(FileGridResources.class));
        }
    
    
        public FileGridAppearance(FileGridResources resources) {
            super(resources);
        }
    
    
    
    }

    then I created a grid object
    Code:
    
    
    Code:
    Grid grid = new Grid<FileModel>(getListStore(), getColumnModel());grid.setView(new GridView<FileModel>(new   FileGridAppearance()));


    this worked well.
    When I create another grid without calling setView method, it should use default
    GridAppearance, however, it has the same appearance with the first one.

    I saw that
    @Shared annotation before
    public interface GridDataTableStyles extends CssResource
    in GridView class.Does that cause the problem?Anybody can help me to solve the problem?Thanks very much.

  2. #2
    Sencha - GXT Dev Team
    Join Date
    Feb 2009
    Location
    Minnesota
    Posts
    2,737
    Vote Rating
    93
      1  

    Default

    This is a bug in the 3.0 release - we are working to change it for 3.1, but could not fix it in a bugfix release, as it requires some API-breaking changes. I've linked this to an internal bug so that we are sure to update this with any progress.

    In the meantime, a workaround: Consider declaring a css class to apply to the root of the grid (added via grid.addStyleName(String)), and namespace your other CSS with that same class name. For example, when changing the rowHighlight behavior, prefix the selector with this other class:

    Code:
    .myGrid .rowHighlight {
      border: 1px dotted #aabbcc;
    }

  3. #3
    Sencha User
    Join Date
    Dec 2012
    Posts
    4
    Vote Rating
    0
      0  

    Default

    Thanks for replying.

  4. #4
    Sencha - GXT Dev Team
    Join Date
    Feb 2009
    Location
    Minnesota
    Posts
    2,737
    Vote Rating
    93
      0  

    Default

    This took a sizable refactor and is an API breaking change, but it is now available in SVN and the nightly builds and will be part of 3.1.

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
  •