Wednesday, January 25, 2017

Cannot add columns to MaterialDataTable. Throws UmbrellaException TypeError.

Hello. 

I'm having an issue with MaterialDataTable (using rc2). It always crashes with: Cannot read property 'insert_37_g$' of undefined. This happens when I try to add a column like table.addColumn(new TextColumn<ContactInfo>() { ... }, "Column");. 

Does anybody know why this is happening ? 

Thanks in advance


MaterialPanel panel = new MaterialPanel();

MaterialLabel title = new MaterialLabel("Contact Information");
title.setTextColor(Color.BLUE);
title.setTextAlign(TextAlign.CENTER);
title.setFontSize("36px");
title.setFontWeight(FontWeight.BOLD);
panel.add(title);

panel.add(new Hr());

MaterialDataTable<ContactInfo> table = new MaterialDataTable<ContactInfo>();
table.setHeight("90%");
table.setUseStickyHeader(true);
table.setUseCategories(false);
table.setUseRowExpansion(false);
table.setSelectionType(SelectionType.NONE);
table.setRedraw(true);

// ... If removing table.addColumn(...) and adding to panel at this point it works, an empty table appears.

table.addColumn(new TextColumn<ContactInfo>() { // The point where exception is thrown.

@Override
public String getHeaderWidth() {
return "20%";
}

@Override
public Comparator<? super RowComponent<ContactInfo>> getSortComparator() {
return (o1, o2) -> o1.getData().getFamilyName().compareTo(o2.getData().getFamilyName());
}

@Override
public String getValue(ContactInfo object) {
return object.getFamilyName();
}
}, "Family Name");

// ...

panel.add(table);


--
You received this message because you are subscribed to the Google Groups "GWT Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit+unsubscribe@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at https://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment