Uploaded image for project: 'ZK'
  1. ZK
  2. ZK-4447

grid skips interval added / interval removed in onListDataChange, cause consistency exception

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Normal Normal
    • 9.0.1
    • 8.6.0, 9.0.0
    • None
    • Security Level: Jimmy
    • None
    • None

      Steps to Reproduce

      run fiddle

      http://zkfiddle.org/sample/cc4vp6/3-Grid-ROD-LiveGridDataLoader-Exception#source-1

      Current Result

      exception:

          Adding causes a smaller list?    Adding causes a smaller list?Caused by:org.zkoss.zk.ui.UiException: Adding causes a smaller list? at org.zkoss.zkmax.zul.impl.LiveGridDataLoader.doLiveListDataChange(LiveGridDataLoader.java:110) at org.zkoss.zkmax.zul.impl.LiveGridDataLoader.doListDataChange(LiveGridDataLoader.java:96) at org.zkoss.zul.Grid.onListDataChange(Grid.java:1164) at org.zkoss.zul.Grid.access$1500(Grid.java:220) at org.zkoss.zul.Grid$2.onChange(Grid.java:905) at org.zkoss.zul.AbstractListModel.fireEvent(AbstractListModel.java:73) at org.zkoss.zul.ListModelList.add(ListModelList.java:170) at jcc4vp6$v3.GridComposer.doAfterCompose(GridComposer.java:24) at org.zkoss.zk.ui.impl.UiEngineImpl.doAfterCompose(UiEngineImpl.java:616) at org.zkoss.zk.ui.impl.UiEngineImpl.execCreateChild0(UiEngineImpl.java:941) at org.zkoss.zk.ui.impl.UiEngineImpl.execCreateChild(UiEngineImpl.java:888) at org.zkoss.zk.ui.impl.UiEngineImpl.execCreate0(UiEngineImpl.java:775) at org.zkoss.zk.ui.impl.UiEngineImpl.execCreateChild(UiEngineImpl.java:835) at org.zkoss.zk.ui.impl.UiEngineImpl.execCreate0(UiEngineImpl.java:793) at org.zkoss.zk.ui.impl.UiEngineImpl.execCreate(UiEngineImpl.java:739) at org.zkoss.zk.ui.impl.UiEngineImpl.execNewPage0(UiEngineImpl.java:460) at org.zkoss.zk.ui.impl.UiEngineImpl.execNewPage(UiEngineImpl.java:368) at org.zkoss.zk.ui.http.DHtmlLayoutServlet.process(DHtmlLayoutServlet.java:215) at org.zkoss.zk.ui.http.DHtmlLayoutServlet.doGet(DHtmlLayoutServlet.java:140) at javax.servlet.http.HttpServlet.service(HttpServlet.java:707) at javax.servlet.http.HttpServlet.service(HttpServlet.java:820) at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:511) at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:401) at org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:216) at org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:182) at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:766) at org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:450) at org.mortbay.jetty.servlet.Dispatcher.forward(Dispatcher.java:327) at org.mortbay.jetty.servlet.Dispatcher.forward(Dispatcher.java:126) at org.mortbay.jetty.servlet.DefaultServlet.doGet(DefaultServlet.java:503) at javax.servlet.http.HttpServlet.service(HttpServlet.java:707) at javax.servlet.http.HttpServlet.service(HttpServlet.java:820) at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:511) at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:401) at org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:216) at org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:182) at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:766) at org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:450) at org.mortbay.jetty.handler.HandlerCollection.handle(HandlerCollection.java:114) at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152) at org.mortbay.jetty.Server.handle(Server.java:326) at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:542) at org.mortbay.jetty.HttpConnection$RequestHandler.headerComplete(HttpConnection.java:928) at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:549) at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:212) at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:404) at org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:410) at org.mortbay.thread.QueuedThreadPool$PoolThread.run(QueuedThreadPool.java:582)

      Expected Result

      no exception

      Debug Information

      model.clear() triggers grid onListDatachange

      https://github.com/zkoss/zk/blame/90ed9472a21fb06858275055486c2d116e914a13/zul/src/org/zkoss/zul/Grid.java#L1156

      without event type Interval removed

      https://github.com/zkoss/zk/blame/90ed9472a21fb06858275055486c2d116e914a13/zul/src/org/zkoss/zul/Grid.java#L1169

      interval event is being ignored by grid

      next interval added event is still being performed here:

      https://github.com/zkoss/zk/blame/90ed9472a21fb06858275055486c2d116e914a13/zul/src/org/zkoss/zul/Grid.java#L1159

      which cause grid consistency exception (model add a new element, content list is shorter)

      Workaround

       

      model.clear();
      grid.setModel(grid.getModel); //triggers internal interval check event
      

       

            rudyhuang rudyhuang
            MDuchemin MDuchemin
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved:

                Estimated:
                Original Estimate - 1 day
                1d
                Remaining:
                Remaining Estimate - 1 day
                1d
                Logged:
                Time Spent - Not Specified
                Not Specified