gwt-material-table icon indicating copy to clipboard operation
gwt-material-table copied to clipboard

2.5 -> 2.6 Error when adding the first column to the

Open robertpic71 opened this issue 3 years ago • 3 comments

When i update my project from 2.5.0 to 2.6.0 or 2.6.1 my table wont build.

I get: "Cannot read properties of undefined (reading 'isHelpEnabled_0_g$')

TypeError: Cannot read properties of undefined (reading 'isHelpEnabled_0_g$') at qHk_g$.zGk_g$ [as isHelpEnabled_0_g$] (Column.java:557:1) at PKk_g$.WKk_g$ [as drawColumnHeader_0_g$] (BaseRenderer.java:322:1) at dPk_g$.CEk_g$ [as renderColumn_0_g$] (AbstractDataView.java:530:1) at dPk_g$.qDk_g$ [as insertColumn_6_g$] (AbstractDataView.java:1139:1) at dPk_g$.CBk_g$ [as addColumn_9_g$] (AbstractDataView.java:1112:1) at dPk_g$.BBk_g$ [as addColumn_8_g$] (AbstractDataView.java:1150:1) at l7k_g$.j3k_g$ [as addColumn_8_g$] (AbstractDataTable.java:332:1) at bu_g$.whl_g$ [as buildTable_0_g$] (MitarbeiterOverlay.java:111:1) at bu_g$.Nhl_g$ [as onClick_0_g$] (MitarbeiterOverlay.java:198:1) at Shl_g$.Thl_g$ [as onClick_0_g$] (MitarbeiterOverlay_MitarbeiterViewUiBinderImpl.java:40:1) at Uch_g$.IJf_g$ [as lambda$2_1_g$] (MaterialWidget.java:1487:1) at vjg_g$.wjg_g$ [as onClick_0_g$] (MaterialWidget.java:1485:1) at ERc_g$.FRc_g$ [as dispatch_4_g$] (ClickEvent.java:56:1) at ERc_g$.GRc_g$ [as dispatch_1_g$] (ClickEvent.java:55:1) at ERc_g$.wQc_g$ [as dispatch_0_g$] (GwtEvent.java:76:1) at D_c_g$ (EventBus.java:40:1)

My view ..ui.xml
   <m:MaterialRow marginTop="5" width="98%">
         <m:MaterialColumn ui:field="maPanel" grid="l12 s12 m12">
            <table:MaterialDataTable ui:field="maTable"
									   shadow="1"
									   useCategories="true"
									   useRowExpansion="false"
									   useStickyHeader="false"
			  						    />
         
        </m:MaterialColumn>
    </m:MaterialRow>
    <m:MaterialButton text="Laden" ui:field="btnload"/>
 </ma:overlay.MaterialOverlay>

Java View

@UiField
MaterialDataTable<MitarbeiterDTO> maTable;

...

public void buildTable() { if (maTable.getColumns().size() > 0) return;

	maTable.setRowFactory(new MitarbeiterRowFactory());
	
	maTable.addColumn(MitarbeiterDTO::getSbrName, "Mitarbeiter");    // error
	maTable.addColumn(MitarbeiterDTO::getAppBezeichnung, "Typ");
	maTable.addColumn(MitarbeiterDTO::getLeZugriff, "Le.Zugriff");
	maTable.addColumn(MitarbeiterDTO::getLeZugriff, "Le.Besuch");

GMW Column.java

public Boolean isHelpEnabled() { if (helpEnabled == null) { Boolean defaultHelpEnabled = getDataView().isHelpEnabled(); helpEnabled = defaultHelpEnabled != null ? defaultHelpEnabled : MaterialDataTable.getGlobals().isHelpEnabled(); // << error } return helpEnabled; }

robertpic71 avatar Oct 24 '22 20:10 robertpic71

Ok will take a look into this.

On Tue, Oct 25, 2022 at 4:08 AM robertpic71 @.***> wrote:

When i update my project from 2.5.0 to 2.6.0 or 2.6.1 my table wont build.

I get: "Cannot read properties of undefined (reading 'isHelpEnabled_0_g$')

TypeError: Cannot read properties of undefined (reading 'isHelpEnabled_0_g$') at qHk_g$.zGk_g$ [as isHelpEnabled_0_g$] (Column.java:557:1) at PKk_g$.WKk_g$ [as drawColumnHeader_0_g$] (BaseRenderer.java:322:1) at dPk_g$.CEk_g$ [as renderColumn_0_g$] (AbstractDataView.java:530:1) at dPk_g$.qDk_g$ [as insertColumn_6_g$] (AbstractDataView.java:1139:1) at dPk_g$.CBk_g$ [as addColumn_9_g$] (AbstractDataView.java:1112:1) at dPk_g$.BBk_g$ [as addColumn_8_g$] (AbstractDataView.java:1150:1) at l7k_g$.j3k_g$ [as addColumn_8_g$] (AbstractDataTable.java:332:1) at bu_g$.whl_g$ [as buildTable_0_g$] (MitarbeiterOverlay.java:111:1) at bu_g$.Nhl_g$ [as onClick_0_g$] (MitarbeiterOverlay.java:198:1) at Shl_g$.Thl_g$ [as onClick_0_g$] (MitarbeiterOverlay_MitarbeiterViewUiBinderImpl.java:40:1) at Uch_g$.IJf_g$ [as lambda$2_1_g$] (MaterialWidget.java:1487:1) at vjg_g$.wjg_g$ [as onClick_0_g$] (MaterialWidget.java:1485:1) at ERc_g$.FRc_g$ [as dispatch_4_g$] (ClickEvent.java:56:1) at ERc_g$.GRc_g$ [as dispatch_1_g$] (ClickEvent.java:55:1) at ERc_g$.wQc_g$ [as dispatch_0_g$] (GwtEvent.java:76:1) at D_c_g$ (EventBus.java:40:1)

My view ..ui.xml <m:MaterialRow marginTop="5" width="98%"> <m:MaterialColumn ui:field="maPanel" grid="l12 s12 m12"> <table:MaterialDataTable ui:field="maTable" shadow="1" useCategories="true" useRowExpansion="false" useStickyHeader="false" />

    </m:MaterialColumn>
</m:MaterialRow>
<m:MaterialButton text="Laden" ui:field="btnload"/>

</ma:overlay.MaterialOverlay>

Java View

@UiField MaterialDataTable<MitarbeiterDTO> maTable;

...

public void buildTable() { if (maTable.getColumns().size() > 0) return;

maTable.setRowFactory(new MitarbeiterRowFactory());

maTable.addColumn(MitarbeiterDTO::getSbrName, "Mitarbeiter"); // error maTable.addColumn(MitarbeiterDTO::getAppBezeichnung, "Typ"); maTable.addColumn(MitarbeiterDTO::getLeZugriff, "Le.Zugriff"); maTable.addColumn(MitarbeiterDTO::getLeZugriff, "Le.Besuch");

GMW Column.java

public Boolean isHelpEnabled() { if (helpEnabled == null) { Boolean defaultHelpEnabled = getDataView().isHelpEnabled(); helpEnabled = defaultHelpEnabled != null ? defaultHelpEnabled : MaterialDataTable.getGlobals().isHelpEnabled(); // << error } return helpEnabled; }

— Reply to this email directly, view it on GitHub https://github.com/GwtMaterialDesign/gwt-material-table/issues/215, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAX6EF63NKSSZ7OYSTBGQUTWE3UEVANCNFSM6AAAAAARNJ7IPM . You are receiving this because you are subscribed to this thread.Message ID: @.***>

kevzlou7979 avatar Oct 24 '22 21:10 kevzlou7979

THX.

My dirty work-a-round:

DateColumn<MitarbeiterDTO> leZugriff = new DateColumn<MitarbeiterDTO>() {
   @Override
    public Date getValue(MitarbeiterDTO object) {
         return (object.getLeZugriff());
     }
leZugriff.setDataView(maTable.getView()); // Problem in 2.6.0/1
....
maTable.addColumn("Le.Verwendung", leZugriff);

I could not find the difference to your working demo :/

robertpic71 avatar Nov 09 '22 12:11 robertpic71

I have the same problem. It's a little curious, as in one table I only get it work when I use above workaround. However, other tables work without the workaround, at least the addColumn call. But there I have a problem with sorting the table; getting a IndexOutOfBoundsException also in the AbstractDataView. I assume it's connected, because in 2.5 everything was working.

kkrupka avatar Jan 17 '23 16:01 kkrupka