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

Listbox forget scroll position when detaching parent component if rod enabled

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Normal Normal
    • 6.5.8, 7.0.4
    • 6.5.7
    • Components
    • Security Level: Jimmy

      Reproducible sample:

      <zk>
      <label multiline="true">
      1. Scorll to bottom and select last listitem
      2. Click "Unload tabbox" button
      3. Click "Back" button.
      Excepted: scroll to selected listitem
      Actual: not scroll to selected listitem (happened to Firefox and IE, chrome works fine)
      </label>
      	<window id="win" border="normal" title="hello" apply="demo.ScrollIntoViewComposer">
      		<button label="Unload tabbox" id="btn1" />
      		<button label="Back" id="btn2" />
      		<tabbox id="tabbox1">
      			<tabs>
      				<tab label="tab1" />
      			</tabs>
      			<tabpanels>
      				<tabpanel>
      					<listbox id="fileList" height="200px" mold="paging" pageSize="10">
      						<custom-attributes org.zkoss.zul.listbox.rod="true"/>
      						<listhead sizable="true">
      							<listheader label="Col 1" width="150px" />
      						</listhead>
      					</listbox>
      				</tabpanel>
      			</tabpanels>
      		</tabbox>
      	</window>
      </zk>
      
      public class ScrollIntoViewComposer extends SelectorComposer<Window> {
      
      	@Wire
      	private Window win;
      	@Wire
      	private Tabbox tabbox1;
      	@Wire
      	private Listbox fileList;
      
      	public void doAfterCompose(Window comp) throws Exception {
      		super.doAfterCompose(comp);
      		ListModelList<String> model = new ListModelList<String>();
      		for (int i = 0; i < 200; i++)
      			model.add("" + i);
      		fileList.setModel(model);
      	}
      	
      	@Listen("onClick = #btn1")
      	public void unload() {
      		tabbox1.detach();
      	}
      	
      	@Listen("onClick = #btn2")
      	public void back() {
      		tabbox1.setParent(win);
      	}
      }
      

      Workaround:
      Turn off ROD can resolve this issue.

            hanhsu hanhsu
            vincentjian vincentjian
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved: