1

I tried to override the getCellStyleNames(Context context, T object) method of Column. But its not working.

I tried to return super.getCellStyleNames(), but it returns null.

What is the problem? What am I supposed to do to fix this problem?

I am using GWT 2.6.rc1.

TextColumn<ContactInfo> firstNameColumn = new TextColumn<ContactInfo>(
            ) {
        @Override
        public String getValue(ContactInfo object) {
            return object.getFirstName() ;
        }

        @Override
        public String getCellStyleNames(Context context, ContactInfo object) {
            Window.alert("X ::: "
                    + super.getCellStyleNames(context, object));
            return "cellTableCell1";
            // object.getAge() % 2 == 0 ? "cellTableCell2"
            // : "cellTableCell1";
            // return "styleName";
        }
    };

Thanks In Advance, Bennet.

Bennet
  • 387
  • 1
  • 6
  • 13
  • have you tried with GWT 2.5.1 ? – Fedy2 Dec 03 '13 at 11:06
  • Tried, but same problem again. What could be the problem? – Bennet Dec 03 '13 at 11:15
  • Are you trying simply to override the default celltable style or something else? – Fedy2 Dec 03 '13 at 11:16
  • Create a style in custom.css and add that in the View with the interface declared and method for the style. Create instance for the style and using that style to return from the overridden method. – Bennet Dec 03 '13 at 11:18
  • your method returns "cellTableCell1" so why you think is not working? – Fedy2 Dec 03 '13 at 11:23
  • But, the style is not applied to the cell. Its taking only the .cellTableEvenRow and .cellTableOddRow, but not the one which I supplied. – Bennet Dec 03 '13 at 11:28
  • let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/42403/discussion-between-bennet-and-fedy2) – Bennet Dec 03 '13 at 11:38

1 Answers1

1

After a discussion in chat we discovered the issue: the style name "cellTableCell1" was declared inside the table CSS resource, therefore the name was obfuscated. Getting the name from the CSS resource solved the issue.

Fedy2
  • 3,147
  • 4
  • 26
  • 44