Skip to Content
author's profile photo Former Member
Former Member

Items not stored in multiComboBox after refresh

Below is the code. In this code I have declared a variable name 
"roStremItems" in which I am getting the items which is in MultiComboBox
control, Problem is that when I navigate to this page, I can get all the 
items by using getItems() function from MultiComboBox control. But when I 
refresh this page it is not giving me the items.

Please see the screenshots afternavigation.jpg and afterrefresh.jpg for reference

var unitContextPath =evt.getParameter("arguments").unitContextPath;
var viewModel=this.getView().getModel();"/"+unitContextPath, //Getting the data which under "/unitContextPath"
           oModel = new sap.ui.model.json.JSONModel();
           oModel.setData(oData); //Set Data from viewModel declare above
           sap.ui.getCore().byId("unitForm").setModel(oModel,"unit"); //Apply Data to "unitForm"
//Get "unitCode_Input" value this control is in view under simple form
           var filters =[];
           var aFilter;
           aFilter= new sap.ui.model.Filter("unit_code.unit_code",sap.ui.model.FilterOperator.EQ,getUnitCode);
sap.ui.getCore().byId("unitBoxes_Input").getBinding("items").filter(filters);//Bind Items to "unitBoxes_Input" multiComboBox control

var roStreamItems=sap.ui.getCore().byId("unitBoxes_Input").getItems();
//Get Items which are bind in prev line. The issue is in this line on refresh this linke is not give the items.
//Select the items which are binded
} ,
    console.log("error retrieving the value of unit"); //Error will come if the service not found
Please Suggest.
Thanks in Advance
afternavigation.jpg (116.5 kB)
afterrefresh.jpg (97.1 kB)
Add comment
10|10000 characters needed characters exceeded

1 Answer

  • Best Answer
    Posted on Feb 23, 2017 at 05:17 PM

    There is no persistent data storage in your application. Are you storing the selected checkboxes into a DB? if so then the same can be retrieved after page refresh as part of 'init' method of controller and loaded into the UI.

    When you are navigating within the app, all the data is stored as part of JSON model and can be accessed. When you refresh the page JSON model is created again newly.

    Add comment
    10|10000 characters needed characters exceeded