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

Calling fireEvent method cause UIexeception with GroupsModel(Rod disabled)

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Normal
    • Resolution: Fixed
    • Affects Version/s: 5.0.10
    • Fix Version/s: 5.0.11
    • Component/s: Components
    • Security Level: Jimmy
    • Labels:

      Description

      When clicking the button , a Uiexeception will show up

      <div width="100%" apply="test.TestComposer">
      	 <custom-attributes org.zkoss.zul.grid.rod="false"/>
      	<grid id="grid"/>
      	<button id="button" label="Run"/>
      </div>
      TestComposer.java
      public class TestComposer extends GenericForwardComposer {
      	private Grid grid;
      
      	private Button button;
      
      	private RowRenderer rowRenderer;
      
      	private MyModel model;
      
      	private class MyModel extends GroupsModelArray {
      
      		public MyModel(String[] data, Comparator<String> comp) {
      			super(data, comp);
      		}
      
      		public void update(int group) {			
      			fireEvent(GroupsDataEvent.GROUPS_CHANGED, 0, group, group);
      		}
      
      		@Override
      		protected Object createGroupHead(Object[] groupdata, int index, int col) {
      			return "HEAD";
      		}
      
      		@Override
      		protected Object createGroupFoot(Object[] groupdata, int index, int col) {
      			return "FOOT";
      		}
      	}
      
      	private class MyRowRenderer implements RowRenderer {
      
      		@Override
      		public void render(Row row, Object data) throws Exception {
      			new Label((String) data).setParent(row);
      		}
      
      	}
      
      	@Override
      	public void doAfterCompose(final Component component) throws Exception {
      		super.doAfterCompose(component);
      
      		String[] data = new String[4];
      		data[0] = "test0";
      		data[1] = "test0";
      		data[2] = "test1";
      		data[3] = "test1";
      
      		rowRenderer = new MyRowRenderer();
      		grid.setRowRenderer(rowRenderer);
      
      		model = new MyModel(data, new Comparator<String>() {
      			@Override
      			public int compare(String o1, String o2) {
      				return o1.compareTo(o2);
      			}
      		});
      		grid.setModel(model);
      
      		button.addEventListener(Events.ON_CLICK, new EventListener() {
      			@Override
      			public void onEvent(Event arg0) throws Exception {
      				model.update(0);
      			}
      		});
      	}
      
      }
      

        Attachments

          Activity

            People

            Assignee:
            TonyQ TonyQ
            Reporter:
            matthewgo matthewgo
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: