Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

SAPUI5: Hiding a <List> via setVisibility not working

I have an xml view with a sap.m.List that holds some sap.m.InputListItems:

<List id="listJobParams">  


  <headerToolbar> ... </headerToolbar>


  <InputListItem label="Partition" id="listItemPartition" visible="false">

    <Select id="partition" selectedKey="{/partition}" />

  </InputListItem>


  ...

</List>

Based on certain conditions, I want to either hide the the entire List or only certain InputListItems, using the setVisibility(true|false) method.

Hiding/showing input list items based on a condition works fine, but hiding/showing the entire list does not work.

The problem: once the list has been hidden via this.byId("listJobParams").setVisibility(false), it is not possible to show the list again using this.byId("listJobParams").setVisibility(true);

There is no error in the js console, but also the list does not show up. So I wonder why the InputListItem behave differently than the List.

Controller code (called from within onInit() method):

_refreshJobDetailInput : function (channelId, eventId, data) {

  // hiding/showing input list item

  this.byId("listItemPartition").setVisible(data.jobType=='singlePartitionIndexingJob');

   

  // hiding/showing the entire list DOES NOT WORK; once hidden, it will never appear again, even though the condition is true (and logs as true in the console)

  this.byId("listJobParams").setVisible(data.jobType=='singlePartitionIndexingJob');

},


The method is available and documented for `sap.m.list`'s parent class (https://openui5.hana.ondemand.com/docs/api/symbols/sap.m.ListBase.html#setVisible)

Tags:
Former Member
Not what you were looking for? View more on this topic or Ask a question