You found a bug! We've classified it as EXTGWT-2803 . We encourage you to continue the discussion and to find an acceptable workaround while we work on a permanent fix.
  1. #1
    Sencha User
    Join Date
    Dec 2012
    Posts
    4
    Vote Rating
    0
    Leowill is on a distinguished road

      0  

    Default How to style multiple grids differently

    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
    Posts
    1,934
    Vote Rating
    55
    Colin Alworth is a jewel in the rough Colin Alworth is a jewel in the rough Colin Alworth is a jewel in the rough

      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
    Leowill is on a distinguished road

      0  

    Default


    Thanks for replying.

Tags for this Thread