Uploaded image for project: 'ZK Spreadsheet'
  1. ZK Spreadsheet
  2. ZSS-1168

merge cells asynchronously in an event queue handler doesn't work

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Critical
    • Resolution: Fixed
    • Affects Version/s: 3.8.2
    • Fix Version/s: 3.8.3
    • Component/s: None
    • Security Level: Jean
    • Labels:
      None
    • gh.sprint.customfield.default.name:
      Sprint 3

      Description

      Steps to reproduce

      1. run the code below

      <zk>
      <div apply="support.performance.SetMassiveCellsComposer" height="100%">
      <button id="eventQueue" label="async event queue"/>
      	<spreadsheet id="ss" width="100%"  height="100%" showSheetbar="true" 
      		maxVisibleRows="1000" maxVisibleColumns="30"  showFormulabar="true"
      		src="/WEB-INF/issue/blank.xlsx" />
      </div>
      
      </zk>
      
      public class SetMassiveCellsComposer extends SelectorComposer {
      	@Wire
      	Spreadsheet ss;
      	
      	private EventQueue<Event> queue = EventQueues.lookup("myQueue");
      	
      	@Override
      	public void doAfterCompose(Component comp) throws Exception {
      		super.doAfterCompose(comp);
      		queue.subscribe(new EventListener<Event>() {
      			
      			@Override
      			public void onEvent(Event e) throws Exception {
      				if (e.getName().equals("onPopulate")){
      					clickMerge();
      					queue.publish(new Event("complete"));
      				}
      			}
      		}, true);
      		
      		queue.subscribe(new EventListener<Event>() {
      			@Override
      			public void onEvent(Event e) throws Exception {
      				if (e.getName().equals("complete")){
      					Ranges.range(ss.getSelectedSheet()).notifyChange();
      					Clients.clearBusy();
      				}
      			}
      		});
      		//publish(null);
      	}
      	
      	@Listen("onClick= #eventQueue")
      	public void publish(Event e){
      		queue.publish(new Event("onPopulate"));
      		Clients.showBusy("populating");
      	}
      	
      	public void clickMerge(){
      		Range range = Ranges.range(ss.getSelectedSheet(), 0, 0, 10, 9);
      		CellOperationUtil.merge(range, true); //or range.merge(true);
      //		Ranges.range(ss.getSelectedSheet()).notifyChange();
      	}
      }
      

      2. click the button to merge cells

      result

      no cell are merged

      debug info

      • For this issue, setAutoRefresh(false) doesn't work for merge(), zss always update to the client directly.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                henrichen henrichen
                Reporter:
                hawk hawk
              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: