Using SmartGWT 3.0, GWT 2.3, and any browser (particularly IE9/FF8). The theme being used is Enterprise with a few CSS color/font tweaks.
The short and sweet version: In certain situations, calling refreshFields() on a ListGrid can cause the body of the list grid to disappear.
The longer version:
Since this is a client-side issue, here is the only stack trace I get in the console. It shows up 3 times before refreshFields() is ever called and another 2 times after. Additionally, it's presense doesn't imply the ListGrid body is going to disappear, so I'm going ot assume it's not part of the problem. Furthermore, it's the only error I get, nothing shows up in the IE JS console or Firebug.
Now, some relavent code is attached, but I'm going to come out and say right now, this problem is not particularly easy to reproduce. When a situation arises that allows me to reproduce the issue, it occurs 100% of the time. The workflow, as far as I know, is this:
1. Our ListGrid gets added to the page with a default grouping, custom dataSource, and custom summaryDataSource. Both dataSources are just RestDataSources.
2. The body data comes back and gets displayed.
3. The grouping and a sorting for the grouping is applied. Since we setShowGroupSummaryInHeader(true), the extra column for the grouping is added.
4. The summary data comes back (possibly for a second time).
5. We call refreshFields() to reset the widths of the columns since the extra column added for the grouping throws things off and the ListGrid body disappears. The headers/summary remain, though the summary is flush with the bottom of the headers. The HTML for the body remains and is sized appropriately, but it's covered by the summary and not visible (see attached, the blue border is the body).
Some things to note:
1. We do some processing to the grouped data after its finished grouping (e.g. the previously mentioned sorting). We determine when the grouping is finished by use of a deferred command.
2. Removing the call to refreshFields() fixes the problem in every case I'm able to reproduce the problem.
3. Putting the call to refreshFields() in another deferred command fixes the problem for the cases where we simply regroup the ListGrid (since every grouping applied ends up calling refreshFields()), but not those where the summaryDataSource appears to be causing the problem.
4. Not using the summaryDataSource also fixes the problem in a number of cases.
5. This is easier to reproduce in Hosted mode, but still occurs outside of hosted mode.
6. This issue also appears to be new to SmartGWT 3.0 (as opposed to 2.5).
Is there anyway to fix refreshFields() or if not, are there any other methods that will readjust the widths of the columns so we don't have to use it?
Thanks.
The short and sweet version: In certain situations, calling refreshFields() on a ListGrid can cause the body of the list grid to disappear.
The longer version:
Since this is a client-side issue, here is the only stack trace I get in the console. It shows up 3 times before refreshFields() is ever called and another 2 times after. Additionally, it's presense doesn't imply the ListGrid body is going to disappear, so I'm going ot assume it's not part of the problem. Furthermore, it's the only error I get, nothing shows up in the IE JS console or Firebug.
Code:
com.smartgwt.client.core.JsObject$SGWT_WARN: 11:39:05.991:WARN:ListGrid:isc_CWListGrid_0_summaryRow:ListGrid.setFields() : neither this ListGrid nor its dataSource have fields at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27) at java.lang.reflect.Constructor.newInstance(Constructor.java:513) at com.google.gwt.dev.shell.MethodAdaptor.invoke(MethodAdaptor.java:105) at com.google.gwt.dev.shell.MethodDispatch.invoke(MethodDispatch.java:71) at com.google.gwt.dev.shell.OophmSessionHandler.invoke(OophmSessionHandler.java:167) at com.google.gwt.dev.shell.BrowserChannelServer.reactToMessagesWhileWaitingForReturn(BrowserChannelServer.java:326) at com.google.gwt.dev.shell.BrowserChannelServer.invokeJavascript(BrowserChannelServer.java:207) at com.google.gwt.dev.shell.ModuleSpaceOOPHM.doInvoke(ModuleSpaceOOPHM.java:132) at com.google.gwt.dev.shell.ModuleSpace.invokeNative(ModuleSpace.java:561) at com.google.gwt.dev.shell.ModuleSpace.invokeNativeVoid(ModuleSpace.java:289) at com.google.gwt.dev.shell.JavaScriptHost.invokeNativeVoid(JavaScriptHost.java:107) at com.smartgwt.client.widgets.grid.ListGrid.refreshFields(ListGrid.java) at ...CWGroupedByHandler$1.execute(CWListGrid.java:410) at com.google.gwt.core.client.impl.SchedulerImpl$Task$.executeScheduled$(SchedulerImpl.java:50) at com.google.gwt.core.client.impl.SchedulerImpl.runScheduledTasks(SchedulerImpl.java:229) at com.google.gwt.core.client.impl.SchedulerImpl.flushPostEventPumpCommands(SchedulerImpl.java:389) at com.google.gwt.core.client.impl.SchedulerImpl$Flusher.execute(SchedulerImpl.java:78) at com.google.gwt.core.client.impl.SchedulerImpl.execute(SchedulerImpl.java:139) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at com.google.gwt.dev.shell.MethodAdaptor.invoke(MethodAdaptor.java:103) at com.google.gwt.dev.shell.MethodDispatch.invoke(MethodDispatch.java:71) at com.google.gwt.dev.shell.OophmSessionHandler.invoke(OophmSessionHandler.java:167) at com.google.gwt.dev.shell.BrowserChannelServer.reactToMessagesWhileWaitingForReturn(BrowserChannelServer.java:326) at com.google.gwt.dev.shell.BrowserChannelServer.invokeJavascript(BrowserChannelServer.java:207) at com.google.gwt.dev.shell.ModuleSpaceOOPHM.doInvoke(ModuleSpaceOOPHM.java:132) at com.google.gwt.dev.shell.ModuleSpace.invokeNative(ModuleSpace.java:561) at com.google.gwt.dev.shell.ModuleSpace.invokeNativeObject(ModuleSpace.java:269) at com.google.gwt.dev.shell.JavaScriptHost.invokeNativeObject(JavaScriptHost.java:91) at com.google.gwt.core.client.impl.Impl.apply(Impl.java) at com.google.gwt.core.client.impl.Impl.entry0(Impl.java:214) at sun.reflect.GeneratedMethodAccessor207.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at com.google.gwt.dev.shell.MethodAdaptor.invoke(MethodAdaptor.java:103) at com.google.gwt.dev.shell.MethodDispatch.invoke(MethodDispatch.java:71) at com.google.gwt.dev.shell.OophmSessionHandler.invoke(OophmSessionHandler.java:167) at com.google.gwt.dev.shell.BrowserChannelServer.reactToMessages(BrowserChannelServer.java:281) at com.google.gwt.dev.shell.BrowserChannelServer.processConnection(BrowserChannelServer.java:531) at com.google.gwt.dev.shell.BrowserChannelServer.run(BrowserChannelServer.java:352) at java.lang.Thread.run(Thread.java:662)
1. Our ListGrid gets added to the page with a default grouping, custom dataSource, and custom summaryDataSource. Both dataSources are just RestDataSources.
2. The body data comes back and gets displayed.
3. The grouping and a sorting for the grouping is applied. Since we setShowGroupSummaryInHeader(true), the extra column for the grouping is added.
4. The summary data comes back (possibly for a second time).
5. We call refreshFields() to reset the widths of the columns since the extra column added for the grouping throws things off and the ListGrid body disappears. The headers/summary remain, though the summary is flush with the bottom of the headers. The HTML for the body remains and is sized appropriately, but it's covered by the summary and not visible (see attached, the blue border is the body).
Some things to note:
1. We do some processing to the grouped data after its finished grouping (e.g. the previously mentioned sorting). We determine when the grouping is finished by use of a deferred command.
2. Removing the call to refreshFields() fixes the problem in every case I'm able to reproduce the problem.
3. Putting the call to refreshFields() in another deferred command fixes the problem for the cases where we simply regroup the ListGrid (since every grouping applied ends up calling refreshFields()), but not those where the summaryDataSource appears to be causing the problem.
4. Not using the summaryDataSource also fixes the problem in a number of cases.
5. This is easier to reproduce in Hosted mode, but still occurs outside of hosted mode.
6. This issue also appears to be new to SmartGWT 3.0 (as opposed to 2.5).
Is there anyway to fix refreshFields() or if not, are there any other methods that will readjust the widths of the columns so we don't have to use it?
Thanks.
Comment