Skip to Content
0

Set flag selected selectDialog before opening

Oct 30, 2017 at 08:44 AM

64

avatar image

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 ?

10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

2 Answers

Arjun Biswas Oct 31, 2017 at 09:49 AM
0

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.

Share
10 |10000 characters needed characters left characters exceeded
Alexander K Nov 01, 2017 at 01:20 AM
0

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.

Share
10 |10000 characters needed characters left characters exceeded