-
2 Feb 2013 8:54 PM #1
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.
-
3 Feb 2013 10:35 PM #2
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 Feb 2013 11:39 PM #3
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.


Reply With Quote