cancel
Showing results for 
Search instead for 
Did you mean: 

Declarative ListBox

Former Member
0 Kudos

Anybody know how to set default selections on a declarative ListBox?

   <div data-sap-ui-type="sap.ui.commons.ListBox" data-allow-multi-select="true" >

   <div data-sap-ui-type="sap.ui.core.ListItem" data-text="List1" data-key="key1"></div>

   <div data-sap-ui-type="sap.ui.core.ListItem" data-text="List2" data-key="key2"></div>

   <div data-sap-ui-type="sap.ui.core.ListItem" data-text="List3" data-key="key3"></div>

Accepted Solutions (0)

Answers (1)

Answers (1)

former_member182650
Contributor
0 Kudos

Hi,

I think only is possible by javascript using setSelectedIndexes

SAPUI5 SDK - Demo Kit

There is no property on constructor and listitem has no property to bind with this purpose.

May be the best option could be develop this call in onInit controller method.

Kind regards

Former Member
0 Kudos

Is there any way to keep the declarative tags in the body and have a Javascript function executed after the declarative components have finished rendering?

I assume this is not guaranteed -

<script>

  $(document).ready(function(){

  ...

  })

</script>