As I was developing a UI that addressed a handful of related by separate cases, I came across a defect in the rerendering logic for ListBox (SAPUI5 library version 1.20.3
).
(Working example here: http://jsbin.com/sidiq/1/edit?html,output )
When the UI is initially rendered, the associated ListBox would not be visible on screen, just the DropdownBox would be visible. Whenever I would alter the visibility state (in particular, making them visible) of elements it would cause the associated ListBox to suddenly appear.
It turns out the ListBox, on rerendering, is creating a second copy of itself in DOM. It's this second copy you're actually seeing on the screen. Once I figured that out I was able to hook the onAfterRendering
event (via the Control.addDelegate()
method) & query the DOM using the jQuery Attribute Equals Selector and remove the extra copy.
One nice byproduct is this gives a nice solution to situations where you want to want a control fully "rendered" as [HTML] DOM, but simply not displayed to the user. The solution employed by the event handler is to call jQuery .remove()
, we could just as easily called .css("display", "none")
Those that prefer a gist can access it here: https://gist.github.com/scollenburg/5ec9ebc9cdae031c08c1
(or clone via git: https://gist.github.com/5ec9ebc9cdae031c08c1.git )
Enjoy,
Shawn
P.S. I'm working on filing this as a bug @ SAP, however that is going slowly, and I wanted to share the issue with everyone.
Message was edited by: Shawn Collenburg