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

focus new listitem in ROD listbox

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Normal Normal
    • 8.5.2
    • 8.0.4.1
    • Components
    • Security Level: Jimmy

      Steps to Reproduce

      run the attached example focus-rod.zul
      click the button

      Actual Result

      textbox in initial listitem is focussed (OK)
      when new listitem is added the textbox is not focussed

      Expected Result

      when new listitem is added the textbox should also be focussed

      Debug Info

      this works as expected when ROD is disabled

      <custom-attributes org.zkoss.zul.listbox.rod="false"/>
      

      Root Cause

      when calling self.focus() the AuFocus response object is correctly added to the reponses
      https://github.com/zkoss/zk/blob/master/zk/src/org/zkoss/zk/ui/impl/UiVisualizer.java#L421

      when rendering the response it get's removed during doCrop()
      https://github.com/zkoss/zk/blob/master/zk/src/org/zkoss/zk/ui/impl/UiVisualizer.java#L654

      Workaround

      1. disable ROD
      2. with ROD enabled: focussing the textbox directly using JS will prevent the response from being filtered out

      Clients.evalJavaScript("zk.$('#" + self.getUuid() + "').focus();");
      

            DevChu DevChu
            cor3000 cor3000
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:

                Estimated:
                Original Estimate - 1 day, 4 hours
                1d 4h
                Remaining:
                Remaining Estimate - 0 minutes
                0m
                Logged:
                Time Spent - 4 hours Time Not Required
                4h