Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GMD-Table RC6 old loading issue #28 #85

Closed
HoochSDS opened this issue Aug 1, 2017 · 14 comments
Closed

GMD-Table RC6 old loading issue #28 #85

HoochSDS opened this issue Aug 1, 2017 · 14 comments
Assignees

Comments

@HoochSDS
Copy link

HoochSDS commented Aug 1, 2017

Hi, after the Major loading improvements to address #19 & #11.
The table load again on each back navigation (attach).
Same issue on GWT-Material Demo.
By the way: The old RC5 setLoadedCallback method worked perfect in GWTP.

    table.setLoadedCallback(new LoadedCallback() {
      @Override
      public void onLoaded() {
        initTable();	// add Column and Handlers
      }
    });

Thank you very much

@BenDol
Copy link
Contributor

BenDol commented Aug 9, 2017

You don't need to use the load callback anymore, you can add your columns and rows in the constructor of your View. Try moving the load callback code into the View constructor and let me know.

@HoochSDS
Copy link
Author

HoochSDS commented Aug 9, 2017

Hi in GWTP the new table initialization (rc6) is not working and you get many exception
and a really strange program behavior.

I hope I can show you with my Example:
As soon you write code against the table-field, the IDE gives you some different Errors.
(Type-Error or superclass error)

error

Look here:
table_rc6

  • you can compile the Program without errors, but as soon the table get touched
    you get a exception on the first table-field. Example: setVisible
Exception caught: Exception caught: (TypeError) : Cannot read property 'setVisible_0_g$' of undefined
  mKh_g$	
  Leh_g$	
  Zdh_g$	
  Ydh_g$	
  ueh_g$	
  NZc_g$	
  _X_g$	
  OX_g$	
  (anonymous function)	
>Exception: com.google.gwt.event.shared.UmbrellaException: Exception caught: Exception caught: (TypeError) : Cannot read property 'setVisible_0_g$' of undefined
  Error: com.google.gwt.event.shared.UmbrellaException: Exception caught: Exception caught: (TypeError) : Cannot read property 'setVisible_0_g$' of undefined

I don't know, what's going on here, but I can't run the table-addin rc6 in GWTP.
Thank you

Here is my GWTP-View

public class TestTab2View extends ViewWithUiHandlers<TestTab2UiHandlers> implements TestTab2Presenter.MyView {
  interface Binder extends UiBinder<HTMLPanel, TestTab2View> {
  }

  @UiField
  MaterialDataTable<TestDTO> table;

  @Inject
  TestTab2View(Binder binder) {
    initWidget(binder.createAndBindUi(this));

    initTable();      // Load Tabledefinition
  }

  private void initTable() {
    
    // Add the tables columns
    table.addColumn(new TextColumn<TestDTO>() {
      @Override
      public Comparator<? super RowComponent<TestDTO>> sortComparator() {
        return (o1, o2) -> o1.getData().getFirstname().compareToIgnoreCase(o2.getData().getFirstname());
      }

      @Override
      public String getValue(TestDTO object) {
        return object.getFirstname();
      }
    }, "Firstname");

    table.addColumn(new TextColumn<TestDTO>() {
      @Override
      public String getValue(TestDTO object) {
        return object.getName();
      }
    }, "Name");

    table.setDestroyOnUnload(false);
  }

  public void setSearchTableData(List<TestDTO> result) {
    table.setVisibleRange(0, result.size());
    table.setRowData(0, result);
    table.refreshView();
  }
}

@BenDol
Copy link
Contributor

BenDol commented Aug 11, 2017

Well you're attempting to manipulate the DOM before it is attached, in the case of accessing the stretch icon for example should be in the onLoad, however I could change it so all the widgets are created in the construction to avoid these issues. BUT there should be a standard to how we manage our widgets and generally onLoad/onUnload should be managed by your application.

@BenDol BenDol self-assigned this Aug 11, 2017
@HoochSDS
Copy link
Author

Hi The IDE-Live code analysis (IDEA) shows there is something wrong. This is not in my hand.
In GWTP I (we) have this DOM manipulation and onLoad problem since the beginning. See #19 #48 #28

Only DataTable RC5 with the Callback-Function was working perfect.

The GMD-Demo Table RC-6 shows this "Load" problem again

Look here:

gmdtabledemorc6

Thanks

@BenDol
Copy link
Contributor

BenDol commented Aug 11, 2017

The data table hasn't been updated yet. None the less I will readd the load callback for the time being in the SNAPSHOT. However I will be updating as I mentioned in my last message.

@BenDol
Copy link
Contributor

BenDol commented Aug 11, 2017

Readded the callback for now 3a37978

@HoochSDS
Copy link
Author

Great!

2.0-SNAPSHOT\gwt-material-table-2.0-20170811.101807-64.jar tested and the Tables in the GWTP-Application are working again; 😃
Only the Deprecated Warnings are annoying. But somehow l have to live with this. 😉

Thank you!

@BenDol
Copy link
Contributor

BenDol commented Aug 21, 2017

Great. So now everything can be done in the constructor, so the setLoadCallback isn't required anymore. Feel free to test it and let me know if you have any troubles.

@BenDol BenDol closed this as completed Aug 21, 2017
@HoochSDS
Copy link
Author

Hi, First the good news:

  • The IDE-Live code analysis (IDEA) issue: has gone

But with the new 2.0-SNAPSHOT\gwt-material-table-2.0-20170821.231700-83.jar
no table can be loaded (REST).

The following exception is thrown.

(TypeError) : this.loaderTask_0_g$.delay_3_g$ is not a function
  k1h_g$	
  Jxh_g$	
  Xwh_g$	
  Wwh_g$	
  sxh_g$	
  R_c_g$	
  _X_g$	
  OX_g$	
  (anonymous function)	
>Exception: com.google.gwt.core.client.JavaScriptException: (TypeError) : this.loaderTask_0_g$.delay_3_g$ is not a function
  TypeError: this.loaderTask_0_g$.delay_3_g$ is not a function
    at HEf_g$.fFf_g$ [as requestData_2_g$] (App-0.js:79320:24)
    at HEf_g$.nFf_g$ [as updateRows_0_g$] (App-0.js:79376:8)
    at HEf_g$.OSj_g$ [as refresh_1_g$] (App-0.js:79243:8)
    at WDi_g$.fEi_g$ [as setSearchTableData_0_g$] (App-0.js:122568:40)
    at kDi_g$.nDi_g$ [as onSuccess_9_g$] (App-0.js:122290:52)
    at kDi_g$.mDi_g$ [as onSuccess_0_g$] (App-0.js:122283:8)
    at wre_g$.xne_g$ [as onExecuteSuccess_0_g$] (App-0.js:52706:22)
    at wre_g$.yne_g$ [as onExecuteSuccess_1_g$] (App-0.js:52710:8)
    at wre_g$.Cre_g$ [as onExecuteSuccess_1_g$] (App-0.js:53855:38)
    at wre_g$.Dre_g$ [as onResponseReceived_1_g$] (App-0.js:53865:10)
    at Hre_g$.Jre_g$ [as onResponseReceived_0_g$] (App-0.js:53924:23)
    at vyc_g$.yyc_g$ [as fireOnResponseReceived_0_g$] (App-0.js:25043:17)
    at Fzc_g$.Gzc_g$ [as onReadyStateChange_0_g$] (App-0.js:25351:28)
    at XMLHttpRequest.<anonymous> (App-0.js:49285:18)
    at LX_g$ (App-0.js:14566:28)
    at OX_g$ (App-0.js:14622:16)
    at XMLHttpRequest.<anonymous> (App-0.js:14602:14)
    k1h_g$	
    m1h_g$	
    l1h_g$	
    Jxh_g$	
    Xwh_g$	
    Wwh_g$	
    sxh_g$	
    R_c_g$	
    _X_g$	
    OX_g$	
    (anonymous function)	
  <console.groupEnd

When I switch back to rc6 with the setLoadCallback function all is working fine!
Thanks

@BenDol
Copy link
Contributor

BenDol commented Aug 22, 2017

This error doesn't make any sense, are you extending and overriding any default InfiniteDataView methods?

Seems like a bad cache issue, can you make sure your cache is cleaned and try again?

If it still isn't working can you send me the basic implementation for me to look at? See if I can spot the issue.

Thanks!

@BenDol BenDol reopened this Aug 22, 2017
@HoochSDS
Copy link
Author

Hi, may be the exception above was really a cache issue.
But I was skeptical and did some Tests and find out:

  • With the MaterialDataTable widget all is working correctly. 👍

untitled

  • With the MaterialInfiniteDataTable --> strange things happen

First you get a endless loop at table.getView().refresh();. And If you comment out the line
you get the table but the addRowSelectHandler is never fired.

Look here:
untitled2

I have change all MaterialInfiniteDataTable to MaterialDataTable in my project.
Here is the GWTP-View: File to the GIF's above
Thanks

public class TestTab2View extends ViewWithUiHandlers<TestTab2UiHandlers> implements TestTab2Presenter.MyView {
  interface Binder extends UiBinder<HTMLPanel, TestTab2View> {
  }

  @UiField
  MaterialDataTable<TestDTO> table;
// MaterialInfiniteDataTable<TestDTO> table;

  @Inject
  TestTab2View(Binder binder) {
    initWidget(binder.createAndBindUi(this));
//    table.setLoadedCallback(new LoadedCallback() {
//      @Override
//      public void onLoaded() {
//        initTable();      // Load Tabledefinition
//      }
//    });
    initTable();
  }

  private void initTable() {
    table.getStretchIcon().setVisible(false);

    table.addColumn(new TextColumn<TestDTO>() {
      @Override
      public String getValue(TestDTO testDTO) {
        return null;
      }
    });
    // Add the tables columns
    table.addColumn(new TextColumn<TestDTO>() {
      @Override
      public Comparator<? super RowComponent<TestDTO>> sortComparator() {
        return (o1, o2) -> o1.getData().getFirstname().compareToIgnoreCase(o2.getData().getFirstname());
      }

      @Override
      public String getValue(TestDTO object) {
        return object.getFirstname();
      }
    }, "Firstname");

    table.addColumn(new TextColumn<TestDTO>() {
      @Override
      public String getValue(TestDTO object) {
        return object.getName();
      }
    }, "Name");

    table.addRowSelectHandler((event, testDTO, element, aBoolean) -> {
      MaterialToast.fireToast("Hello Select-Row Event");		// never reached with MaterialInfiniteDataTable
      return true;
    });

    table.setDestroyOnUnload(false);
  }

  public void setSearchTableData(List<TestDTO> result) {
    table.setVisibleRange(0, result.size());
    table.setRowData(0, result);
    table.getView().refresh();						// causes endless Loop with MaterialInfiniteDataTable
  }									// you can comment this line out, then you get the table,
									// but the addRowSelectHandler is never fired
}

@BenDol
Copy link
Contributor

BenDol commented Aug 24, 2017

Thanks for the information, can you try it on the latest snapshot (updated recently) I made a few fixes to the InfiniteDataView that might resolve these issues.

@HoochSDS
Copy link
Author

Hi, I tested the latest MaterialInfiniteDataTable
2.0-SNAPSHOT\gwt-material-table-2.0-20170821.231700-83.jar
but the behavior has not changed.

@HoochSDS
Copy link
Author

HoochSDS commented Sep 1, 2017

Hi, Attention
In gwt-material-table-2.0-20170824.233802-89.jar is a new issue: in AbstractDataView.class :697
Code:

....
            pageSizeChanged = pageStart - start;
            if(this.getVisibleItemCount() > 0 && pageSizeChanged < pageSize) {
              for(i = 0; i < pageSizeChanged; ++i) {
                this.rows.add((Component)null);
              }
            }
...

Exception: Row-Click Listener

Uncaught ReferenceError: WQj_g$ is not defined
  Rvf_g$	
  zzf_g$	
  lambda_0_g$	
  o	
  dispatch	
  r.handle	
Uncaught ReferenceError: WQj_g$ is not defined
  Nvf_g$	
  bzf_g$	
  lambda_0_g$	
  dispatch	
  r.handle

Update:
2.0-SNAPSHOT\gwt-material-table-2.0-20170821.231700-83.jar
in combination with
2.0-SNAPSHOT\gwt-material-jquery-2.0-20170821.230732-18.jar
is working!

Thanks

@BenDol BenDol closed this as completed Sep 24, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants