1

I have a CellList that I want to style. I want to change the cursor style, the ugly color of a selected cell . I checked several questions and discussions on stack overflow,but none of them worked. I checked these one:

CellList GWT CSS Style

How do I style a gwt 2.1 CellTables headers?

Her is my code:

public interface CellListResource extends CellList.Resources {


  public static CellListResource INSTANCE = GWT.create(CellListResource.class);

  interface CellListStyle extends CellList.Style {

  }

  @Source({CellList.Style.DEFAULT_CSS, "CellTableStyle.css"})
  CellListStyle style();
}

 public SearchViewImpl() {

    CompanyCell companyCell = new CompanyCell();
//it doesn't work :S 
    companiesList = new CellList<Company>(companyCell, CellListResource.INSTANCE);

    rootElement = ourUiBinder.createAndBindUi(this);

    loadingImage.setVisible(false);
  }

Am I missing something? I Cleared Browser cache, Restarted server, F5 F5 F5 .... F5 (pressed refresh again and again) and nothing ...! Thanks for help in advance.

Community
  • 1
  • 1
Adelin
  • 18,144
  • 26
  • 115
  • 175

2 Answers2

3

Besides injecting the CSS it's important that you call the CellListStyle style cellListStyle() and not just style():

public interface CellListResource extends CellList.Resources {
  public static CellListResource INSTANCE = GWT.create(CellListResource.class);
  interface CellListStyle extends CellList.Style {}

  @Override
  @Source("cellListStyle.css")
  CellListStyle cellListStyle();
}

and then you do

CellListResource.INSTANCE.cellListStyle().ensureInjected();
companiesList = new CellList<Company>(companyCell, CellListResource.INSTANCE);
tamalet
  • 657
  • 6
  • 5
  • I wondered why it is important to call the method `cellListStyle()` and not `style()`. This comment is for you if you wonder similarly. The clue is in the `@Override` annotation: you need to override the method of that name in `CellList.Resources`. – Matt Wallis Aug 29 '14 at 09:21
2

Make sure you inject the css resource.

CellTableResources.INSTANCE.cellTableStyle().ensureInjected();
myCellTable = new CellTable<T>(Integer.MAX_VALUE,CellTableResources.INSTANCE);

You can follow the following link

How do you change the mouse over highlighting?

Community
  • 1
  • 1
Abhijith Nagaraja
  • 3,370
  • 6
  • 27
  • 55