Monday, June 10, 2013

Re: 'firstChild' is null or not an object - Error by deleting the last node of the CellTree

I have just come across the same issue in GWT 2.5.1 on IE8/9/10. I've used CellTrees a lot and never seen this issue before.

I have avoided the issue by disabling the keyboard selection

tree.setKeyboardSelectionPolicy(KeyboardSelectionPolicy.DISABLED);

P.

On Thursday, 7 July 2011 11:36:15 UTC+1, rmartinsfidalgo wrote:
Hi

I have a little issue about the CellTree specially by deleting the
last node.
I created a normal CellTree with a root node and data nodes like this:

ROOT
     >DATA A
     >DATA B
     >DATA C

The Root contain the dataProvider (which is ListDataProvider) where I
add data nodes or deleted.
For adding the code is:
  dataProvider.getList().add(node);
  dataProvider.refresh();
For deleting the code is:
   if (childNode != null && dataProvider.getList().contains(node)) {
      dataProvider.getList().remove(node);
      dataProvider.refresh();
   }


This works fine in Chrome and in Firefox 3.5.

But for IE 8.0. when I deleting the last node (in this case the DATA
C) there is an JavaScriptException see below.

Is there a workaround?

com.google.gwt.core.client.JavaScriptException: (TypeError):
'firstChild' is null or not an object
 number: -2146823281
 description: 'firstChild' is null or not an object
        
com.google.gwt.dev.shell.BrowserChannelServer.invokeJavascript(BrowserChannelServer.java:
237)
        
com.google.gwt.dev.shell.ModuleSpaceOOPHM.doInvoke(ModuleSpaceOOPHM.java:
129)
        com.google.gwt.dev.shell.ModuleSpace.invokeNative(ModuleSpace.java:
561)
        
com.google.gwt.dev.shell.ModuleSpace.invokeNativeObject(ModuleSpace.java:
269)
        
com.google.gwt.dev.shell.JavaScriptHost.invokeNativeObject(JavaScriptHost.java:
91)
        com.google.gwt.dom.client.DOMImpl.getFirstChildElement(DOMImpl.java)
        com.google.gwt.dom.client.Element$.getFirstChildElement$(Element.java:
241)
        
com.google.gwt.user.cellview.client.CellTreeNodeView.getCellParent(CellTreeNodeView.java:
660)
        
com.google.gwt.user.cellview.client.CellTreeNodeView.getCellParent(CellTreeNodeView.java:
1039)
        
com.google.gwt.user.cellview.client.CellTreeNodeView.setKeyboardSelected(CellTreeNodeView.java:
1234)
        
com.google.gwt.user.cellview.client.CellTree.keyboardSelect(CellTree.java:
884)
        com.google.gwt.user.cellview.client.CellTreeNodeView$NodeCellList
$View.loadChildState(CellTreeNodeView.java:340)
        com.google.gwt.user.cellview.client.CellTreeNodeView$NodeCellList
$View.replaceAllChildren(CellTreeNodeView.java:211)
        
com.google.gwt.user.cellview.client.HasDataPresenter.resolvePendingState(HasDataPresenter.java:
1348)
        com.google.gwt.user.cellview.client.HasDataPresenter.access
$3(HasDataPresenter.java:1112)
        com.google.gwt.user.cellview.client.HasDataPresenter
$2.execute(HasDataPresenter.java:1037)
        com.google.gwt.core.client.impl.SchedulerImpl$Task$.executeScheduled$
(SchedulerImpl.java:50)
        
com.google.gwt.core.client.impl.SchedulerImpl.runScheduledTasks(SchedulerImpl.java:
229)
        
com.google.gwt.core.client.impl.SchedulerImpl.flushFinallyCommands(SchedulerImpl.java:
328)
        com.google.gwt.core.client.impl.Impl.exit(Impl.java:238)
        com.google.gwt.core.client.impl.Impl.entry0(Impl.java:229)
        sun.reflect.GeneratedMethodAccessor40.invoke(Unknown Source)
        
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:
25)
        java.lang.reflect.Method.invoke(Method.java:597)
        com.google.gwt.dev.shell.MethodAdaptor.invoke(MethodAdaptor.java:103)
        com.google.gwt.dev.shell.MethodDispatch.invoke(MethodDispatch.java:
71)
        
com.google.gwt.dev.shell.OophmSessionHandler.invoke(OophmSessionHandler.java:
157)
        
com.google.gwt.dev.shell.BrowserChannelServer.reactToMessages(BrowserChannelServer.java:
281)
        
com.google.gwt.dev.shell.BrowserChannelServer.processConnection(BrowserChannelServer.java:
531)
        
com.google.gwt.dev.shell.BrowserChannelServer.run(BrowserChannelServer.java:
352)
        java.lang.Thread.run(Thread.java:662)

--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" 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 http://groups.google.com/group/google-web-toolkit?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

No comments:

Post a Comment