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

Listbox setRows removes shallSize, prevents flexing

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Normal Normal
    • None
    • 10.0.0, 9.6.5
    • None
    • None

      Steps to Reproduce

      Run fiddle code in ZK 10
      https://zkfiddle.org/sample/2qhcb2d/2-setRows-break-flex

      Press button to trigger both setInvalidItems and setRows on listbox
      Click in textbox

      Current Result

      textbox doesn't flex up to cell width

      Expected Result

      textbox flexes up to cell width

      Debug Information

      setInvalidateItems set _shallSize to true
      setRows call onSize immediately, which removes the _shallSize value from the listbox
      Since _shallSize is not true, listbox doesn't trigger size calculation for items, as it should have after processing commands.

      (threshold attribute set to trigger invalidItems with single add, but would trigger without attribute if replaced content > 10)

      Workaround

      	<script><![CDATA[
      		zk.afterLoad("zul.sel", function () {
      		    var _xListbox = {};
      		    zk.override(zul.sel.Listbox.prototype, _xListbox, {
      		        setRows: function() {
      		        	var shallSize = this._shallSize;
      					var result = _xListbox.setRows.apply(this, arguments);
      					this._shallSize = shallSize;
      					return result;
      		        }
      		     });
      		});
      	]]></script>
      

            Unassigned Unassigned
            MDuchemin MDuchemin
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated: