on 05-01-2014 4:28 PM
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)
Hi Mathias,
yeah, i have seen these kinda issues at time. Once you do the list.setVisibile(true), manually rerender the list or page in the next line, either list.rerender() or page.rerender() . This is the workaround for the issue.
Regards
Sakthivel
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
It looks like a defect. I recommend putting it up on jsbin & submitting a bug report.
An alternate workaround is to hook the onAfterRendering
event & use jQuery .css("display", "none")
to hide or show the DOM element. SAPUI5 "visible : true
" means "in the DOM" and "visible : false
" means the DOM element is removed or simply not created.
User | Count |
---|---|
95 | |
11 | |
10 | |
9 | |
9 | |
7 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.