Skip to Content

Declarative ListBox

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>

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

1 Answer

  • Posted on Feb 12, 2014 at 07:30 PM

    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

    Add a comment
    10|10000 characters needed characters exceeded

    • 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>

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.