1
votes

I have a dropdown control in view and button which should all the values in page. Basically which acts like refresh button

Now when I select on value from the drop down and when I clicked the Clear button. I am using the below code for refresh the view

View name is Metrics.

I am deleting the content and adding the same

sap.ui.getCore().byId("idContainer").removeAllContent();

var view = sap.ui.getCore().byId("idMetrics");
sap.ui.getCore().byId("idContainer").addContent(view);

The value in the button is not getting cleared. I have used several methods provided in the UI5 API reference library to clear the content But the value not getting clear

Can you please let me know how to clear the value from the Drop down I am using the list Item to add the contents to the DropDown

Thanks Pawan Akella

1
Pawan, Clearing the dropdown values on click of the button.Is this is your requirement?If not please mention the exact requirement.anjaly
Hi Rob, yes this is my requirement and i am using inplaceedit control to attached drp down valuesPawan Akella

1 Answers

0
votes

The values you write into the Controls will be saved in the Core, so you should give each Control a DataBinding and use setData to set them empty

Option one:

Completely empty Data Object

var aData = {};
sap.ui.getCore().getModel("YourModel").setData(aData);

Option two:

You define all the control-contents that should be default and put them into an object and then set these Data

var defaultPartnerDaten = {
    archived: "", 
    nummer: "", 
    anrede: "",
    vorname: "DefaultData", 
    nachname: "",
    date: "", 
    strasse: "DefaultData",
    hausnummer: "",
    plz: "", 
    ort: "",
    land: "",
    teles: [],
    faxs: [],
    mobils: [],
    emails: [],
    bankverbindungen: [],
    kfz: "",
    schein: "",
    schaden: "",
    typ: "",
    ortsteil: "",
    nation: ""
};

The controls which are DataBinded to vorname and strasse will have the value DefaultData