Skip to Content

Set flag selected selectDialog before opening

Hi, all.

I am using selectDialog in fragment for selecting some values, but before the opening fragment , i need set some list elements as SELECTED.

How i can do it ?

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

2 Answers

  • Oct 31, 2017 at 09:49 AM

    How are you getting the values, is it through OData or any model or are you setting static values.

    In any case, on instantiating the selectDialog and setting it to a model, get the list elements, look for your desired element and use the method "setRememberSelections" to select that element. Now that whenever your dialog opens, the specific elements will be selected. For more reference, go through the "remember selections" property in the select dialog. You can use the foll. urls for your reference.

    https://sapui5.hana.ondemand.com/#/api/sap.m.SelectDialog

    https://sapui5.hana.ondemand.com/#/sample/sap.m.sample.SelectDialog/preview

    Hope this helps,

    Regards.

    Add comment
    10|10000 characters needed characters exceeded

  • Nov 01, 2017 at 01:20 AM

    Hello, Arjun

    Thanks for help. But i can't understand your answer.

    I am getting values for SelectDialog from one Odata model, but for set selection flag I need to get data from second model and compare some data in first and second models.

    Now i am using code below before open dialog.

    var itms = sap.ui.getCore().byId("selU").getItems();

    for (var k = 0; k < itms.length; k++) {

    if somevalue === somevue2 {

    sap.ui.getCore().byId("selU").getItems()[k].mProperties.selected = true

    }

    }

    this.dialog.setModel(this.getView().getModel("oModel"));

    this.dialog.open();

    But mayby it is not good solution.

    Add comment
    10|10000 characters needed characters exceeded